From a0e6c9203b192ac2381482ed1fbab19adeb8e442 Mon Sep 17 00:00:00 2001 From: vzapo Date: Tue, 21 Jan 2020 21:43:35 +0000 Subject: [PATCH 1/8] created mod setaotw and removeaotw commands --- .env.example | 6 +++-- commands/mod/removeaotw.js | 49 ++++++++++++++++++++++++++++++++++++++ commands/mod/setaotw.js | 49 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 commands/mod/removeaotw.js create mode 100644 commands/mod/setaotw.js diff --git a/.env.example b/.env.example index 56b1683..44e55e6 100644 --- a/.env.example +++ b/.env.example @@ -9,7 +9,7 @@ RA_USER= RA_TOKEN= RA_WEB_API_KEY= -#role IDs for "self role management" +#role IDs and names NEWS_ROLES= ACHIEVEMENT_NEWS= COMMUNITY_NEWS= @@ -18,6 +18,8 @@ EVENT_NEWS= DEVELOPER_NEWS= REVISION_VOTING= ROLE_MOD= +ROLE_MOD_NAME= +AOTW_ROLE_ID= YOUTUBE_API_KEY= @@ -46,4 +48,4 @@ TMDB_KEY= YANDEX_KEY= # Wordnik key, used by the define command -WORDNIK_KEY= +WORDNIK_KEY= \ No newline at end of file diff --git a/commands/mod/removeaotw.js b/commands/mod/removeaotw.js new file mode 100644 index 0000000..89b6f44 --- /dev/null +++ b/commands/mod/removeaotw.js @@ -0,0 +1,49 @@ +const logger = require('pino')({ + useLevelLabels: true, + timestamp: () => `,"time":"${new Date()}"`, +}); + +const { ROLE_MOD_NAME, AOTW_ROLE_ID } = process.env; +const Command = require('../../structures/Command.js'); + +module.exports = class SayCommand extends Command { + constructor(client) { + super(client, { + name: 'removeaotw', + group: 'mod', + memberName: 'removeaotw', + aliases: ['aotwremove'], + description: 'Removes the AOTW Winner role from designated user.', + args: [ + { + key: 'username', + prompt: 'Who would you like to have the role removed from?', + type: 'user', + }, + ], + }); + } + + async run(msg, { username }) { + // check if the requested user to be given role exists + const user = await msg.guild.fetchMember(username); + + const hasAOTW = await user.roles.has(AOTW_ROLE_ID); + // if the the user has the role, if not do nothing + if (!hasAOTW) { + return; + } + // check if AOTW WINNER role exists on the channel + const aotwRole = await msg.guild.roles.get(AOTW_ROLE_ID); + // check if requesting user is mod user + const isMod = await msg.member.roles.find((role) => role.name === ROLE_MOD_NAME); + + // if all checks pass give the role to the user + if (user && isMod && aotwRole) { + // remove role from the user + await user.removeRole(aotwRole).catch(logger.error); + logger.info({ msg: `@Mod ${msg.member.displayName} removed ${aotwRole.name} from ${user.displayName}` }); + msg.say(`**${aotwRole.name}** has been removed from user **${user.displayName}**.`); + } + } +}; diff --git a/commands/mod/setaotw.js b/commands/mod/setaotw.js new file mode 100644 index 0000000..a4f571a --- /dev/null +++ b/commands/mod/setaotw.js @@ -0,0 +1,49 @@ +const logger = require('pino')({ + useLevelLabels: true, + timestamp: () => `,"time":"${new Date()}"`, +}); + +const { ROLE_MOD_NAME, AOTW_ROLE_ID } = process.env; +const Command = require('../../structures/Command.js'); + +module.exports = class SayCommand extends Command { + constructor(client) { + super(client, { + name: 'setaotw', + group: 'mod', + memberName: 'setaotw', + aliases: ['giveaotw', 'aotwaward'], + description: 'Offers AOTW Winner role to designated user.', + args: [ + { + key: 'username', + prompt: 'Who would you like to give the role to?', + type: 'user', + }, + ], + }); + } + + async run(msg, { username }) { + // check if the requested user to be given role exists + const user = await msg.guild.fetchMember(username); + + const hasAOTW = await user.roles.has(AOTW_ROLE_ID); + // if the user already has the role, do nothing + if (hasAOTW) { + return; + } + // check if AOTW WINNER role exists on the channel + const aotwRole = await msg.guild.roles.get(AOTW_ROLE_ID); + // check if requesting user is mod user + const isMod = await msg.member.roles.find((role) => role.name === ROLE_MOD_NAME); + + // if all checks pass give the role to the user + if (user && isMod && aotwRole) { + // award the user the role + await user.addRole(aotwRole).catch(logger.error); + logger.info({ msg: `@Mod ${msg.member.displayName} added ${aotwRole.name} to ${user.displayName}` }); + msg.say(`:trophy: Congratulations **${user.displayName}**. You have been awarded **${aotwRole.name}**!`); + } + } +}; From 3b6bb732c454c7ce4b3b17db6d5e039e06a7b955 Mon Sep 17 00:00:00 2001 From: vzapo Date: Fri, 24 Jan 2020 03:56:18 +0000 Subject: [PATCH 2/8] changed to role id ROLE_MOD --- commands/mod/removeaotw.js | 4 ++-- commands/mod/setaotw.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/mod/removeaotw.js b/commands/mod/removeaotw.js index 89b6f44..1b816d4 100644 --- a/commands/mod/removeaotw.js +++ b/commands/mod/removeaotw.js @@ -3,7 +3,7 @@ const logger = require('pino')({ timestamp: () => `,"time":"${new Date()}"`, }); -const { ROLE_MOD_NAME, AOTW_ROLE_ID } = process.env; +const { ROLE_MOD, AOTW_ROLE_ID } = process.env; const Command = require('../../structures/Command.js'); module.exports = class SayCommand extends Command { @@ -36,7 +36,7 @@ module.exports = class SayCommand extends Command { // check if AOTW WINNER role exists on the channel const aotwRole = await msg.guild.roles.get(AOTW_ROLE_ID); // check if requesting user is mod user - const isMod = await msg.member.roles.find((role) => role.name === ROLE_MOD_NAME); + const isMod = await msg.member.roles.has(ROLE_MOD); // if all checks pass give the role to the user if (user && isMod && aotwRole) { diff --git a/commands/mod/setaotw.js b/commands/mod/setaotw.js index a4f571a..98d7051 100644 --- a/commands/mod/setaotw.js +++ b/commands/mod/setaotw.js @@ -3,7 +3,7 @@ const logger = require('pino')({ timestamp: () => `,"time":"${new Date()}"`, }); -const { ROLE_MOD_NAME, AOTW_ROLE_ID } = process.env; +const { ROLE_MOD, AOTW_ROLE_ID } = process.env; const Command = require('../../structures/Command.js'); module.exports = class SayCommand extends Command { @@ -36,7 +36,7 @@ module.exports = class SayCommand extends Command { // check if AOTW WINNER role exists on the channel const aotwRole = await msg.guild.roles.get(AOTW_ROLE_ID); // check if requesting user is mod user - const isMod = await msg.member.roles.find((role) => role.name === ROLE_MOD_NAME); + const isMod = await msg.member.roles.has(ROLE_MOD); // if all checks pass give the role to the user if (user && isMod && aotwRole) { From 886dabe4ec876749bfa43d6280ef1060b2750160 Mon Sep 17 00:00:00 2001 From: vzapo Date: Mon, 27 Jan 2020 20:24:41 +0000 Subject: [PATCH 3/8] added setaotw and removeaotw commands --- commands/mod/removeaotw.js | 83 ++++++++++++++++++++++++++++++++++++++ commands/mod/setaotw.js | 49 ++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 commands/mod/removeaotw.js create mode 100644 commands/mod/setaotw.js diff --git a/commands/mod/removeaotw.js b/commands/mod/removeaotw.js new file mode 100644 index 0000000..becca45 --- /dev/null +++ b/commands/mod/removeaotw.js @@ -0,0 +1,83 @@ +const logger = require('pino')({ + useLevelLabels: true, + timestamp: () => `,"time":"${new Date()}"`, +}); + +const { ROLE_MOD, AOTW_ROLE_ID } = process.env; +const Command = require('../../structures/Command.js'); + +module.exports = class RemoveAOTWCommand extends Command { + constructor(client) { + super(client, { + name: 'removeaotw', + group: 'mod', + memberName: 'removeaotw', + aliases: ['aotwremove'], + description: 'Removes the AOTW Winner role from designated user.', + examples:['!removeaotw @user', '!removeaotw'], + args: [ + { + key: 'username', + prompt: 'Who would you like to have the role removed from?', + type: 'user', + default: '', + }, + ], + }); + } + + async run(msg, { username }) { + // check if AOTW WINNER role exists on the channel + const aotwRole = await msg.guild.roles.get(AOTW_ROLE_ID); + // check if requesting user is mod user + const isMod = await msg.member.roles.has(ROLE_MOD); + + if(!isMod){ + return; + } + + if (username !== '') { + // check if the requested user to be given role exists + const user = await msg.guild.fetchMember(username); + + const hasAOTW = await user.roles.has(AOTW_ROLE_ID); + + // if the the user has the role, if not do nothing + if (!hasAOTW) { + return; + } + + // if all checks pass give the role to the user + if (user && aotwRole) { + // remove role from the user + await user.removeRole(aotwRole).catch(logger.error); + logger.info({ msg: `@Mod ${msg.member.displayName} removed ${aotwRole.name} from ${user.displayName}` }); + msg.say(`**${aotwRole.name}** has been removed from user **${user.displayName}**.`); + } + } else { + await msg.channel.send('Are you sure you want to remove from all users? Please answer with `yes` or `y` if so.'); + + const filter = (res) => res.content.includes('yes') || res.content.toLowerCase() === 'y'; + + const msgs = await msg.channel.awaitMessages(filter, { + max: 1, + time: 3000, + }); + + if (msgs.size) { + const users = msg.guild.members; + let aotwUsers = 0; + users.forEach(async (user) => { + if (user.roles.has(AOTW_ROLE_ID)) { + aotwUsers += 1; + await user.removeRole(aotwRole); + } + }); + logger.info({ msg: `@Mod ${msg.member.displayName} removed ${aotwRole.name} from ${aotwUsers} users` }); + msg.say(`**${aotwRole.name}** role has been removed from **${aotwUsers}** users.`); + } else { + msg.say('Cancelled command.'); + } + } + } +}; diff --git a/commands/mod/setaotw.js b/commands/mod/setaotw.js new file mode 100644 index 0000000..04651da --- /dev/null +++ b/commands/mod/setaotw.js @@ -0,0 +1,49 @@ +const logger = require('pino')({ + useLevelLabels: true, + timestamp: () => `,"time":"${new Date()}"`, +}); + +const { ROLE_MOD, AOTW_ROLE_ID } = process.env; +const Command = require('../../structures/Command.js'); + +module.exports = class SetAOTWCommand extends Command { + constructor(client) { + super(client, { + name: 'setaotw', + group: 'mod', + memberName: 'setaotw', + aliases: ['giveaotw', 'aotwaward'], + description: 'Offers AOTW Winner role to designated user.', + examples:['!setaotw @user'], + args: [ + { + key: 'username', + prompt: 'Who would you like to give the role to?', + type: 'user', + }, + ], + }); + } + + async run(msg, { username }) { + // check if the requested user to be given role exists + const user = await msg.guild.fetchMember(username); + + // check if AOTW WINNER role exists on the channel + const aotwRole = await msg.guild.roles.get(AOTW_ROLE_ID); + // check if requesting user is mod user + const isMod = await msg.member.roles.has(ROLE_MOD); + const hasAOTW = await user.roles.has(AOTW_ROLE_ID); + // if the user already has the role, do nothing + if (hasAOTW) { + return; + } + // if all checks pass give the role to the user + if (user && isMod && aotwRole) { + // award the user the role + await user.addRole(aotwRole).catch(logger.error); + logger.info({ msg: `@Mod ${msg.member.displayName} added ${aotwRole.name} to ${user.displayName}` }); + msg.say(`:trophy: Congratulations **${user.displayName}**. You have been awarded **${aotwRole.name}** role!`); + } + } +}; From 43da5fc82f810225c5edfb256aa672bb1f810371 Mon Sep 17 00:00:00 2001 From: vzapo Date: Mon, 27 Jan 2020 20:31:02 +0000 Subject: [PATCH 4/8] finished removeaotw --- .env.example | 6 ++- commands/mod/removeaotw.js | 83 ++++++++++++++++++++++++++++++++++++++ commands/mod/setaotw.js | 49 ++++++++++++++++++++++ 3 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 commands/mod/removeaotw.js create mode 100644 commands/mod/setaotw.js diff --git a/.env.example b/.env.example index 56b1683..44e55e6 100644 --- a/.env.example +++ b/.env.example @@ -9,7 +9,7 @@ RA_USER= RA_TOKEN= RA_WEB_API_KEY= -#role IDs for "self role management" +#role IDs and names NEWS_ROLES= ACHIEVEMENT_NEWS= COMMUNITY_NEWS= @@ -18,6 +18,8 @@ EVENT_NEWS= DEVELOPER_NEWS= REVISION_VOTING= ROLE_MOD= +ROLE_MOD_NAME= +AOTW_ROLE_ID= YOUTUBE_API_KEY= @@ -46,4 +48,4 @@ TMDB_KEY= YANDEX_KEY= # Wordnik key, used by the define command -WORDNIK_KEY= +WORDNIK_KEY= \ No newline at end of file diff --git a/commands/mod/removeaotw.js b/commands/mod/removeaotw.js new file mode 100644 index 0000000..6cdb071 --- /dev/null +++ b/commands/mod/removeaotw.js @@ -0,0 +1,83 @@ +const logger = require('pino')({ + useLevelLabels: true, + timestamp: () => `,"time":"${new Date()}"`, +}); + +const { ROLE_MOD, AOTW_ROLE_ID } = process.env; +const Command = require('../../structures/Command.js'); + +module.exports = class RemoveAOTWCommand extends Command { + constructor(client) { + super(client, { + name: 'removeaotw', + group: 'mod', + memberName: 'removeaotw', + aliases: ['aotwremove'], + description: 'Removes the AOTW Winner role from designated user.', + examples: ['!removeaotw @user', '!removeaotw'], + args: [ + { + key: 'username', + prompt: 'Who would you like to have the role removed from?', + type: 'user', + default: '', + }, + ], + }); + } + + async run(msg, { username }) { + // check if AOTW WINNER role exists on the channel + const aotwRole = await msg.guild.roles.get(AOTW_ROLE_ID); + // check if requesting user is mod user + const isMod = await msg.member.roles.has(ROLE_MOD); + + if (!isMod) { + return; + } + + if (username !== '') { + // check if the requested user to be given role exists + const user = await msg.guild.fetchMember(username); + + const hasAOTW = await user.roles.has(AOTW_ROLE_ID); + + // if the the user has the role, if not do nothing + if (!hasAOTW) { + return; + } + + // if all checks pass give the role to the user + if (user && aotwRole) { + // remove role from the user + await user.removeRole(aotwRole).catch(logger.error); + logger.info({ msg: `@Mod ${msg.member.displayName} removed ${aotwRole.name} from ${user.displayName}` }); + msg.say(`**${aotwRole.name}** has been removed from user **${user.displayName}**.`); + } + } else { + await msg.channel.send('Are you sure you want to remove from all users? Please answer with `yes` or `y` if so.'); + + const filter = (res) => res.content.includes('yes') || res.content.toLowerCase() === 'y'; + + const msgs = await msg.channel.awaitMessages(filter, { + max: 1, + time: 3000, + }); + + if (msgs.size) { + const users = msg.guild.members; + let aotwUsers = 0; + users.forEach(async (user) => { + if (user.roles.has(AOTW_ROLE_ID)) { + aotwUsers += 1; + await user.removeRole(aotwRole); + } + }); + logger.info({ msg: `@Mod ${msg.member.displayName} removed ${aotwRole.name} from ${aotwUsers} users` }); + msg.say(`**${aotwRole.name}** role has been removed from **${aotwUsers}** users.`); + } else { + msg.say(':no_entry: Cancelled command.'); + } + } + } +}; diff --git a/commands/mod/setaotw.js b/commands/mod/setaotw.js new file mode 100644 index 0000000..981551c --- /dev/null +++ b/commands/mod/setaotw.js @@ -0,0 +1,49 @@ +const logger = require('pino')({ + useLevelLabels: true, + timestamp: () => `,"time":"${new Date()}"`, +}); + +const { ROLE_MOD, AOTW_ROLE_ID } = process.env; +const Command = require('../../structures/Command.js'); + +module.exports = class SetAOTWCommand extends Command { + constructor(client) { + super(client, { + name: 'setaotw', + group: 'mod', + memberName: 'setaotw', + aliases: ['giveaotw', 'aotwaward'], + description: 'Offers AOTW Winner role to designated user.', + examples: ['!setaotw @user'], + args: [ + { + key: 'username', + prompt: 'Who would you like to give the role to?', + type: 'user', + }, + ], + }); + } + + async run(msg, { username }) { + // check if the requested user to be given role exists + const user = await msg.guild.fetchMember(username); + + // check if AOTW WINNER role exists on the channel + const aotwRole = await msg.guild.roles.get(AOTW_ROLE_ID); + // check if requesting user is mod user + const isMod = await msg.member.roles.has(ROLE_MOD); + const hasAOTW = await user.roles.has(AOTW_ROLE_ID); + // if the user already has the role, do nothing + if (hasAOTW) { + return; + } + // if all checks pass give the role to the user + if (user && isMod && aotwRole) { + // award the user the role + await user.addRole(aotwRole).catch(logger.error); + logger.info({ msg: `@Mod ${msg.member.displayName} added ${aotwRole.name} to ${user.displayName}` }); + msg.say(`:trophy: Congratulations **${user.displayName}**. You have been awarded **${aotwRole.name}** role!`); + } + } +}; From 806ceb157946289358e9af6f9b767581abac9ef5 Mon Sep 17 00:00:00 2001 From: vzapo Date: Mon, 27 Jan 2020 20:42:45 +0000 Subject: [PATCH 5/8] added prompt confirmation --- commands/mod/removeaotw.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/commands/mod/removeaotw.js b/commands/mod/removeaotw.js index 7878f05..7cba02b 100644 --- a/commands/mod/removeaotw.js +++ b/commands/mod/removeaotw.js @@ -14,7 +14,7 @@ module.exports = class RemoveAOTWCommand extends Command { memberName: 'removeaotw', aliases: ['aotwremove'], description: 'Removes the AOTW Winner role from designated user.', - examples: ['!removeaotw @user', '!removeaotw'], + examples:['!removeaotw @user', '!removeaotw'], args: [ { key: 'username', @@ -32,7 +32,7 @@ module.exports = class RemoveAOTWCommand extends Command { // check if requesting user is mod user const isMod = await msg.member.roles.has(ROLE_MOD); - if (!isMod) { + if(!isMod){ return; } @@ -55,9 +55,9 @@ module.exports = class RemoveAOTWCommand extends Command { msg.say(`**${aotwRole.name}** has been removed from user **${user.displayName}**.`); } } else { - await msg.channel.reply('Are you sure you want to remove from all users? Please `cancel` now if not.'); + await msg.channel.send('Are you sure you want to remove from all users? Please confirm with `yes` or `y` if so.'); - const filter = (res) => res.content.includes('cancel') || res.content.toLowerCase() === 'cancel'; + const filter = (res) => res.content.includes('yes') || res.content.toLowerCase() === 'y'; const msgs = await msg.channel.awaitMessages(filter, { max: 1, @@ -65,8 +65,6 @@ module.exports = class RemoveAOTWCommand extends Command { }); if (msgs.size) { - msg.reply('Cancelled command.'); - } else { const users = msg.guild.members; let aotwUsers = 0; users.forEach(async (user) => { @@ -77,6 +75,8 @@ module.exports = class RemoveAOTWCommand extends Command { }); logger.info({ msg: `@Mod ${msg.member.displayName} removed ${aotwRole.name} from ${aotwUsers} users` }); msg.say(`**${aotwRole.name}** role has been removed from **${aotwUsers}** users.`); + } else { + msg.say('Cancelled command.'); } } } From ad64f13bb8da0c8cc337f19e2b52a917c00f9c5b Mon Sep 17 00:00:00 2001 From: meleu Date: Mon, 27 Jan 2020 22:52:57 -0300 Subject: [PATCH 6/8] Update setaotw.js * not using aliases (I realized it brings more confusion than "user-friendliness") * giving proper feedback when the command fails * other cleanups --- commands/mod/setaotw.js | 54 ++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/commands/mod/setaotw.js b/commands/mod/setaotw.js index 981551c..4d4508d 100644 --- a/commands/mod/setaotw.js +++ b/commands/mod/setaotw.js @@ -3,17 +3,17 @@ const logger = require('pino')({ timestamp: () => `,"time":"${new Date()}"`, }); -const { ROLE_MOD, AOTW_ROLE_ID } = process.env; +const { ROLE_MOD, ROLE_AOTW } = process.env; const Command = require('../../structures/Command.js'); -module.exports = class SetAOTWCommand extends Command { +module.exports = class SetAotwCommand extends Command { constructor(client) { super(client, { name: 'setaotw', group: 'mod', + guildOnly: true, memberName: 'setaotw', - aliases: ['giveaotw', 'aotwaward'], - description: 'Offers AOTW Winner role to designated user.', + description: 'Offers AotW Winner role to designated user.', examples: ['!setaotw @user'], args: [ { @@ -26,24 +26,38 @@ module.exports = class SetAOTWCommand extends Command { } async run(msg, { username }) { - // check if the requested user to be given role exists - const user = await msg.guild.fetchMember(username); + const callerIsMod = await msg.member.roles.has(ROLE_MOD); + if (!callerIsMod) { + return msg.reply('Only moderators can use such command.'); + } - // check if AOTW WINNER role exists on the channel - const aotwRole = await msg.guild.roles.get(AOTW_ROLE_ID); - // check if requesting user is mod user - const isMod = await msg.member.roles.has(ROLE_MOD); - const hasAOTW = await user.roles.has(AOTW_ROLE_ID); - // if the user already has the role, do nothing - if (hasAOTW) { - return; + const aotwRole = await msg.guild.roles.get(ROLE_AOTW); + if (!aotwRole) { + return msg.reply( + ":warning: Looks like there's no role for AotW winners in this server (or maybe I just don't know the role ID).", + ); } - // if all checks pass give the role to the user - if (user && isMod && aotwRole) { - // award the user the role - await user.addRole(aotwRole).catch(logger.error); - logger.info({ msg: `@Mod ${msg.member.displayName} added ${aotwRole.name} to ${user.displayName}` }); - msg.say(`:trophy: Congratulations **${user.displayName}**. You have been awarded **${aotwRole.name}** role!`); + + const user = await msg.guild.fetchMember(username); + // the args config in the constructor guarantees that 'username' is a valid user + + const userHasAotw = await user.roles.has(ROLE_AOTW); + if (userHasAotw) { + return msg.reply(`The user **${user.displayName}** already has the **${aotwRole.name}** role.`); } + + return user.addRole(aotwRole) + .then(() => { + logger.info( + { msg: `@Mod ${msg.member.displayName} added ${aotwRole.name} to ${user.displayName}` }, + ); + msg.say( + `:trophy: Congratulations **${user.displayName}**. You have been awarded **${aotwRole.name}** role!`, + ); + }) + .catch((err) => { + logger.error(err); + msg.reply(`I wasn't able to give the **${aotwRole.name}** role to **${user.displayName}**... :frowning2:`); + }); } }; From 2dd27f1c4c5c8f3a63a77e43910c7f6a944c1d0d Mon Sep 17 00:00:00 2001 From: meleu Date: Mon, 27 Jan 2020 22:53:52 -0300 Subject: [PATCH 7/8] Update .env.example --- .env.example | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 44e55e6..6bbfe07 100644 --- a/.env.example +++ b/.env.example @@ -9,7 +9,7 @@ RA_USER= RA_TOKEN= RA_WEB_API_KEY= -#role IDs and names +# always use role IDs (avoid problems if a role is renamed) NEWS_ROLES= ACHIEVEMENT_NEWS= COMMUNITY_NEWS= @@ -18,8 +18,7 @@ EVENT_NEWS= DEVELOPER_NEWS= REVISION_VOTING= ROLE_MOD= -ROLE_MOD_NAME= -AOTW_ROLE_ID= +ROLE_AOTW= YOUTUBE_API_KEY= @@ -48,4 +47,4 @@ TMDB_KEY= YANDEX_KEY= # Wordnik key, used by the define command -WORDNIK_KEY= \ No newline at end of file +WORDNIK_KEY= From 46e8b2689712dcff8a8c3a3076275f5ee4f7b7cb Mon Sep 17 00:00:00 2001 From: meleu Date: Mon, 27 Jan 2020 22:55:47 -0300 Subject: [PATCH 8/8] Update setaotw.js --- commands/mod/setaotw.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/mod/setaotw.js b/commands/mod/setaotw.js index 4d4508d..9282c90 100644 --- a/commands/mod/setaotw.js +++ b/commands/mod/setaotw.js @@ -39,7 +39,7 @@ module.exports = class SetAotwCommand extends Command { } const user = await msg.guild.fetchMember(username); - // the args config in the constructor guarantees that 'username' is a valid user + // no need to check for success, the args config in the constructor guarantees that 'username' is valid. const userHasAotw = await user.roles.has(ROLE_AOTW); if (userHasAotw) {