From f77e70d4d2354d2c36f9285b97723232859061b9 Mon Sep 17 00:00:00 2001 From: Dragory Date: Wed, 1 Aug 2018 00:52:44 +0300 Subject: [PATCH] fix: percentage signs in mod action reasons causing crashes This is an issue with audit log reasons that are sent as an HTML header. Eris tries to decodeURI these before sending them, which throws an error if you have an invalid percent encoding in the reason (e.g. "100%"). See eris/issues/276 and RequestHandler.js#L74 --- src/plugins/ModActions.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/ModActions.ts b/src/plugins/ModActions.ts index 1e828653..a0fd51cc 100644 --- a/src/plugins/ModActions.ts +++ b/src/plugins/ModActions.ts @@ -308,7 +308,7 @@ 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 member.addRole(this.configValue("mute_role")); await this.mutes.addOrUpdateMute(member.id, muteTime); } @@ -404,7 +404,7 @@ export class ModActionsPlugin extends Plugin { // Remove "muted" role this.serverLogs.ignoreLog(LogType.MEMBER_ROLE_REMOVE, args.member.id); - await args.member.removeRole(this.configValue("mute_role"), args.reason); + await args.member.removeRole(this.configValue("mute_role")); await this.mutes.clear(args.member.id); // Confirm the action to the moderator @@ -517,7 +517,7 @@ export class ModActionsPlugin extends Plugin { try { this.ignoreEvent(IgnoredEventType.Unban, args.userId); - await this.guild.unbanMember(args.userId, args.reason); + await this.guild.unbanMember(args.userId); } catch (e) { msg.channel.createMessage(errorMessage("Failed to unban member")); return;