diff --git a/commands/moderation/ban.js b/commands/moderation/ban.js index 3283501d..0704890f 100644 --- a/commands/moderation/ban.js +++ b/commands/moderation/ban.js @@ -35,15 +35,15 @@ module.exports = class BanCommand extends Command { } hasPermission(msg) { - return msg.member.hasPermission('BAN_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff')); + return msg.member.hasPermission('BAN_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole')); } async run(msg, args) { if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS')) return msg.say('This Command requires the `Ban Members` Permission.'); - const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs')); + const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog')); if (!modlogs) - return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.'); + return msg.say('This Command requires a channel set with the `modchannel` command.'); if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { member, reason } = args; diff --git a/commands/moderation/kick.js b/commands/moderation/kick.js index 8e71c07b..1e38b87e 100644 --- a/commands/moderation/kick.js +++ b/commands/moderation/kick.js @@ -32,15 +32,15 @@ module.exports = class KickCommand extends Command { } hasPermission(msg) { - return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff')); + return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole')); } async run(msg, args) { if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS')) return msg.say('This Command requires the `Kick Members` Permission.'); - const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs')); + const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog')); if (!modlogs) - return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.'); + return msg.say('This Command requires a channel set with the `modchannel` command.'); if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { member, reason } = args; diff --git a/commands/moderation/prune.js b/commands/moderation/prune.js index b577296c..b9c2f6d9 100644 --- a/commands/moderation/prune.js +++ b/commands/moderation/prune.js @@ -29,7 +29,7 @@ module.exports = class PruneCommand extends Command { } hasPermission(msg) { - return msg.member.hasPermission('MANAGE_MESSAGES') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff')); + return msg.member.hasPermission('MANAGE_MESSAGES') || msg.member.roles.has(msg.guild.settings.get('staffRole')); } async run(msg, args) { diff --git a/commands/moderation/softban.js b/commands/moderation/softban.js index b4e1179a..91d143aa 100644 --- a/commands/moderation/softban.js +++ b/commands/moderation/softban.js @@ -32,7 +32,7 @@ module.exports = class SoftbanCommand extends Command { } hasPermission(msg) { - return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff')); + return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole')); } async run(msg, args) { @@ -40,9 +40,9 @@ module.exports = class SoftbanCommand extends Command { return msg.say('This Command requires the `Ban Members` Permission.'); if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS')) return msg.say('This Command requires the `Kick Members` Permission.'); - const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs')); + const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog')); if (!modlogs) - return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.'); + return msg.say('This Command requires a channel set with the `modchannel` command.'); if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { member, reason } = args; diff --git a/commands/moderation/unban.js b/commands/moderation/unban.js index ec76cb1e..d637702e 100644 --- a/commands/moderation/unban.js +++ b/commands/moderation/unban.js @@ -39,15 +39,15 @@ module.exports = class UnbanCommand extends Command { } hasPermission(msg) { - return msg.member.hasPermission('BAN_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff')); + return msg.member.hasPermission('BAN_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole')); } async run(msg, args) { if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS')) return msg.say('This Command requires the `Ban Members` Permission.'); - const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs')); + const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog', 'mod_logs')); if (!modlogs) - return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.'); + return msg.say('This Command requires a channel set with the `modchannel` command.'); if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { id, reason } = args; diff --git a/commands/moderation/warn.js b/commands/moderation/warn.js index 53992fc6..70b3c7d9 100644 --- a/commands/moderation/warn.js +++ b/commands/moderation/warn.js @@ -31,13 +31,13 @@ module.exports = class WarnCommand extends Command { } hasPermission(msg) { - return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.exists('name', msg.guild.settings.get('staffRole', 'Server Staff')); + return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole')); } async run(msg, args) { - const modlogs = msg.guild.channels.find('name', msg.guild.settings.get('modLog', 'mod_logs')); + const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog', 'mod_logs')); if (!modlogs) - return msg.say('This Command requires a channel named `mod_logs` or one custom set with the `modchannel` command.'); + return msg.say('This Command requires a channel set with the `modchannel` command.'); if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) return msg.say('This Command requires the `Embed Links` Permission.'); const { member, reason } = args; diff --git a/commands/util/memberchannel.js b/commands/util/memberchannel.js index 4bc2456e..6b9517fe 100644 --- a/commands/util/memberchannel.js +++ b/commands/util/memberchannel.js @@ -24,7 +24,7 @@ module.exports = class MemberLogCommand extends Command { run(msg, args) { const { channel } = args; - msg.guild.settings.set('memberLog', channel.name); + msg.guild.settings.set('memberLog', channel.id); return msg.say(`Member Log channel set to ${channel.name}.`); } }; diff --git a/commands/util/modchannel.js b/commands/util/modchannel.js index 73964dfd..0968c823 100644 --- a/commands/util/modchannel.js +++ b/commands/util/modchannel.js @@ -24,7 +24,7 @@ module.exports = class ModChannelCommand extends Command { run(msg, args) { const { channel } = args; - msg.guild.settings.set('modLog', channel.name); + msg.guild.settings.set('modLog', channel.id); return msg.say(`Mod Log channel set to ${channel.name}.`); } }; diff --git a/commands/util/staffrole.js b/commands/util/staffrole.js index 21f599c5..d2393ac3 100644 --- a/commands/util/staffrole.js +++ b/commands/util/staffrole.js @@ -24,7 +24,7 @@ module.exports = class StaffRoleCommand extends Command { run(msg, args) { const { role } = args; - msg.guild.settings.set('staffRole', role.name); + msg.guild.settings.set('staffRole', role.id); return msg.say(`Server Staff role set to ${role.name}.`); } }; diff --git a/html/carbonuse.html b/html/carbonuse.html index cf38d111..619aba1c 100644 --- a/html/carbonuse.html +++ b/html/carbonuse.html @@ -11,8 +11,9 @@

Notes:

    -
  1. Moderation Commands Require a Channel Named "mod_logs" to send Ban/Kick/Unban/Warn Logs, or you can set a channel with x;modchannel
  2. -
  3. To use Member Join/Leave Logging, make a channel named "member_logs", or set a channel with x;memberchannel
  4. +
  5. Moderation Commands Require a Channel set with x;modchannel to send Ban/Kick/Unban/Warn Logs
  6. +
  7. To use Member Join/Leave Logging, set a channel with x;memberchannel
  8. +
  9. You can set a special role that is able to use Moderation commands (excluding lockdown) with x;staffrole
  10. Use x;help to View a Command List
  11. Visit my Home Server for more support, or for updates, or if you just want to hang out.
diff --git a/html/discordbots.html b/html/discordbots.html index 2905935d..a4ab8389 100644 --- a/html/discordbots.html +++ b/html/discordbots.html @@ -57,8 +57,9 @@

Notes:

    -
  1. Moderation Commands Require a Channel Named "mod_logs" to send Ban/Kick/Unban/Warn Logs, or you can set a channel with x;modchannel
  2. -
  3. To use Member Join/Leave Logging, make a channel named "member_logs", or set a channel with x;memberchannel
  4. +
  5. Moderation Commands Require a Channel set with x;modchannel to send Ban/Kick/Unban/Warn Logs
  6. +
  7. To use Member Join/Leave Logging, set a channel with x;memberchannel
  8. +
  9. You can set a special role that is able to use Moderation commands (excluding lockdown) with x;staffrole
  10. Use x;help to View a Command List
  11. Visit my Home Server for more support, or for updates, or if you just want to hang out.
diff --git a/index.js b/index.js index a45ff698..63c91d8a 100644 --- a/index.js +++ b/index.js @@ -38,14 +38,14 @@ client.registry .registerCommandsIn(path.join(__dirname, 'commands')); client.on('guildMemberAdd', (member) => { - const channel = member.guild.channels.find('name', member.guild.settings.get('memberLog', 'member_logs')); + const channel = member.guild.channels.get(member.guild.settings.get('memberLog')); if (!channel) return; if (!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return; channel.send(`Welcome ${member.user.username}!`); }); client.on('guildMemberRemove', (member) => { - const channel = member.guild.channels.find('name', member.guild.settings.get('memberLog', 'member_logs')); + const channel = member.guild.channels.get(member.guild.settings.get('memberLog')); if (!channel) return; if (!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return; channel.send(`Bye ${member.user.username}...`); diff --git a/package.json b/package.json index 9baf9cbe..1bf8b84d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "17.2.12", + "version": "18.0.0", "description": "A Discord Bot", "main": "shardingmanager.js", "scripts": {