From ac67342e43ce70e78a30ee6aeb7e0abefaffbcde Mon Sep 17 00:00:00 2001 From: Almeida Date: Sun, 9 May 2021 21:43:09 +0100 Subject: [PATCH 1/2] made RoleAddCmd and RoleRemoveCmd mention the command author --- backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts | 4 +++- .../src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts index 0568ea41..45345c78 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts @@ -43,6 +43,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, + { users: true }, ); lock.unlock(); return; @@ -87,6 +88,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Got an error while trying to grant you the roles`, + { users: true }, ); return; } @@ -118,7 +120,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ messageParts.push("couldn't recognize some of the roles"); } - sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`); + sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`, { users: true }); lock.unlock(); }, diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts index 0ba51766..1a896e1e 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts @@ -51,12 +51,14 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ msg.channel, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord};` + ` couldn't recognize the other roles you mentioned`, + { users: true }, ); } else { sendSuccessMessage( pluginData, msg.channel, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`, + { users: true }, ); } } catch { @@ -64,6 +66,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Got an error while trying to remove the roles`, + { users: true }, ); } } else { @@ -71,6 +74,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, + { users: true }, ); } From b38eeeab4275c7346d20da48702910dbdaf08c47 Mon Sep 17 00:00:00 2001 From: almeidx Date: Sat, 14 Aug 2021 14:54:18 +0100 Subject: [PATCH 2/2] update for discord.js --- .../src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts | 8 +++++--- .../plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts index 45345c78..8fa9cca4 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleAddCmd.ts @@ -43,7 +43,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, - { users: true }, + { users: [msg.author.id] }, ); lock.unlock(); return; @@ -88,7 +88,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Got an error while trying to grant you the roles`, - { users: true }, + { users: [msg.author.id] }, ); return; } @@ -120,7 +120,9 @@ export const RoleAddCmd = selfGrantableRolesCmd({ messageParts.push("couldn't recognize some of the roles"); } - sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`, { users: true }); + sendSuccessMessage(pluginData, msg.channel, `<@!${msg.author.id}> ${messageParts.join("; ")}`, { + users: [msg.author.id], + }); lock.unlock(); }, diff --git a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts index 1a896e1e..7a4bb83b 100644 --- a/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts +++ b/backend/src/plugins/SelfGrantableRoles/commands/RoleRemoveCmd.ts @@ -51,14 +51,14 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ msg.channel, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord};` + ` couldn't recognize the other roles you mentioned`, - { users: true }, + { users: [msg.author.id] }, ); } else { sendSuccessMessage( pluginData, msg.channel, `<@!${msg.author.id}> Removed ${removedRolesStr.join(", ")} ${removedRolesWord}`, - { users: true }, + { users: [msg.author.id] }, ); } } catch { @@ -66,7 +66,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Got an error while trying to remove the roles`, - { users: true }, + { users: [msg.author.id] }, ); } } else { @@ -74,7 +74,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({ pluginData, msg.channel, `<@!${msg.author.id}> Unknown ${args.roleNames.length === 1 ? "role" : "roles"}`, - { users: true }, + { users: [msg.author.id] }, ); }