mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
Allow -clean, essentially softban in kick command
This commit is contained in:
parent
af360eaa73
commit
ac33a0de1e
1 changed files with 30 additions and 1 deletions
|
@ -1098,6 +1098,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
{ name: "mod", type: "member" },
|
{ name: "mod", type: "member" },
|
||||||
{ name: "notify", type: "string" },
|
{ name: "notify", type: "string" },
|
||||||
{ name: "notify-channel", type: "channel" },
|
{ name: "notify-channel", type: "channel" },
|
||||||
|
{ name: "clean", isSwitch: true },
|
||||||
],
|
],
|
||||||
extra: {
|
extra: {
|
||||||
info: {
|
info: {
|
||||||
|
@ -1108,7 +1109,14 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
@d.permission("can_kick")
|
@d.permission("can_kick")
|
||||||
async kickCmd(
|
async kickCmd(
|
||||||
msg,
|
msg,
|
||||||
args: { user: string; reason: string; mod: Member; notify?: string; "notify-channel"?: TextChannel },
|
args: {
|
||||||
|
user: string;
|
||||||
|
reason: string;
|
||||||
|
mod: Member;
|
||||||
|
notify?: string;
|
||||||
|
"notify-channel"?: TextChannel;
|
||||||
|
clean?: boolean;
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
const user = await this.resolveUser(args.user);
|
const user = await this.resolveUser(args.user);
|
||||||
if (!user) return this.sendErrorMessage(msg.channel, `User not found`);
|
if (!user) return this.sendErrorMessage(msg.channel, `User not found`);
|
||||||
|
@ -1152,6 +1160,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const reason = this.formatReasonWithAttachments(args.reason, msg.attachments);
|
const reason = this.formatReasonWithAttachments(args.reason, msg.attachments);
|
||||||
|
|
||||||
const kickResult = await this.kickMember(memberToKick, reason, {
|
const kickResult = await this.kickMember(memberToKick, reason, {
|
||||||
contactMethods,
|
contactMethods,
|
||||||
caseArgs: {
|
caseArgs: {
|
||||||
|
@ -1160,6 +1169,26 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (args.clean) {
|
||||||
|
this.serverLogs.ignoreLog(LogType.MEMBER_BAN, memberToKick.id);
|
||||||
|
this.ignoreEvent(IgnoredEventType.Ban, memberToKick.id);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await memberToKick.ban(1);
|
||||||
|
} catch (e) {
|
||||||
|
this.sendErrorMessage(msg.channel, "Failed to ban the user to clean messages (-clean)");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.serverLogs.ignoreLog(LogType.MEMBER_UNBAN, memberToKick.id);
|
||||||
|
this.ignoreEvent(IgnoredEventType.Unban, memberToKick.id);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.guild.unbanMember(memberToKick.id);
|
||||||
|
} catch (e) {
|
||||||
|
this.sendErrorMessage(msg.channel, "Failed to unban the user after banning them (-clean)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (kickResult.status === "failed") {
|
if (kickResult.status === "failed") {
|
||||||
msg.channel.createMessage(errorMessage(`Failed to kick user`));
|
msg.channel.createMessage(errorMessage(`Failed to kick user`));
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue