Add spam plugin. Add clean commands. Update Knub to 9.6.0.

This commit is contained in:
Dragory 2018-07-31 02:42:45 +03:00
parent ad6afdfac1
commit 7ded84b924
11 changed files with 539 additions and 85 deletions

View file

@ -258,6 +258,11 @@ export class ModActionsPlugin extends Plugin {
});
}
public async muteMember(member: Member, muteTime: number = null, reason: string = null) {
await member.addRole(this.configValue("mute_role"), reason);
await this.mutes.addOrUpdateMute(member.id, muteTime);
}
@d.command("mute", "<member:Member> [time:string] [reason:string$]")
@d.permission("mute")
async muteCmd(msg: Message, args: any) {
@ -283,8 +288,7 @@ export class ModActionsPlugin extends Plugin {
// Apply "muted" role
this.serverLogs.ignoreLog(LogType.MEMBER_ROLE_ADD, args.member.id);
await args.member.addRole(this.configValue("mute_role"), args.reason);
await this.mutes.addOrUpdateMute(args.member.id, muteTime);
this.muteMember(args.member, muteTime, args.reason);
// Create a case
await this.createCase(args.member.id, msg.author.id, CaseType.Mute, null, args.reason);
@ -713,7 +717,7 @@ export class ModActionsPlugin extends Plugin {
return this.displayCase(caseOrCaseId, caseLogChannelId);
}
protected async createCase(
public async createCase(
userId: string,
modId: string,
caseType: CaseType,
@ -770,6 +774,7 @@ export class ModActionsPlugin extends Plugin {
if (!member) continue;
try {
this.serverLogs.ignoreLog(LogType.MEMBER_ROLE_REMOVE, member.id);
await member.removeRole(this.configValue("mute_role"));
} catch (e) {} // tslint:disable-line