diff options
Diffstat (limited to 'src/commands/moderation')
-rw-r--r-- | src/commands/moderation/ban.ts | 12 | ||||
-rw-r--r-- | src/commands/moderation/kick.ts | 10 | ||||
-rw-r--r-- | src/commands/moderation/role.ts | 22 |
3 files changed, 22 insertions, 22 deletions
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index f843ac4..4847d19 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -1,9 +1,9 @@ import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteraction, Message, User } from 'discord.js'; import moment from 'moment'; +import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; -import { SlashCommandOption } from '../../lib/extensions/Util'; import { Ban, Guild, Modlog, ModlogType } from '../../lib/models'; const durationAliases: Record<string, string[]> = { @@ -133,8 +133,8 @@ export default class BanCommand extends BushCommand { await modlogEnry.save(); await banEntry.save(); } catch (e) { - console.error(e); - yield 'Error saving to database. Please report this to a developer.'; + this.client.console.error(`BanCommand`, `Error saving to database. ${e?.stack}`); + yield `${this.client.util.emojis.error} Error saving to database. Please report this to a developer.`; return; } try { @@ -144,18 +144,18 @@ export default class BanCommand extends BushCommand { } with reason \`${reason || 'No reason given'}\`` ); } catch (e) { - yield 'Error sending message to user'; + yield `${this.client.util.emojis.warn} Unable to dm user`; } await message.guild.members.ban(user, { reason: `Banned by ${message instanceof CommandInteraction ? message.user.tag : message.author.tag} with ${ reason ? `reason ${reason}` : 'no reason' }` }); - yield `Banned <@!${user.id}> ${ + yield `${this.client.util.emojis.success} Banned <@!${user.id}> ${ translatedTime.length >= 1 ? `for ${translatedTime.join(', ')}` : 'permanently' } with reason \`${reason || 'No reason given'}\``; } catch { - yield 'Error banning :/'; + yield `${this.client.util.emojis.error} Error banning :/`; await banEntry.destroy(); await modlogEnry.destroy(); return; diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index eed0122..7bd53e0 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -71,14 +71,14 @@ export default class KickCommand extends BushCommand { }); await modlogEnry.save(); } catch (e) { - console.error(e); - yield 'Error saving to database. Please report this to a developer.'; + this.client.console.error(`BanCommand`, `Error saving to database. ${e?.stack}`); + yield `${this.client.util.emojis.error} Error saving to database. Please report this to a developer.`; return; } try { await user.send(`You were kicked in ${message.guild.name} with reason \`${reason || 'No reason given'}\``); } catch (e) { - yield 'Error sending message to user'; + yield `${this.client.util.emojis.warn} Unable to dm user`; } try { await user.kick( @@ -87,11 +87,11 @@ export default class KickCommand extends BushCommand { }` ); } catch { - yield 'Error kicking :/'; + yield `${this.client.util.emojis.error} Error kicking :/`; await modlogEnry.destroy(); return; } - yield `Kicked <@!${user.id}> with reason \`${reason || 'No reason given'}\``; + yield `${this.client.util.emojis.success} Kicked <@!${user.id}> with reason \`${reason || 'No reason given'}\``; } async exec(message: Message, { user, reason }: { user: GuildMember; reason?: string }): Promise<void> { diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index 8951560..1b82245 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -43,7 +43,7 @@ export default class RoleCommand extends BushCommand { type: 'member', prompt: { start: `What user do you want to add/remove the role on?`, - retry: `<:error:837123021016924261> Choose a valid user to add/remove the role on.` + retry: `{error} Choose a valid user to add/remove the role on.` } }, { @@ -52,7 +52,7 @@ export default class RoleCommand extends BushCommand { match: 'restContent', prompt: { start: `What role do you want to add/remove?`, - retry: `<:error:837123021016924261> Choose a valid role to add/remove.` + retry: `{error} Choose a valid role to add/remove.` } } ], @@ -78,7 +78,7 @@ export default class RoleCommand extends BushCommand { const mappedRole = this.client.util.moulberryBushRoleMap.find((m) => m.id === role.id); if (!mappedRole || !this.roleWhitelist[mappedRole.name]) { return message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is not whitelisted, and you do not have manage roles permission.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is not whitelisted, and you do not have manage roles permission.`, allowedMentions: AllowedMentions.none() }); } @@ -87,7 +87,7 @@ export default class RoleCommand extends BushCommand { }); if (!message.member.roles.cache.some((role) => allowedRoles.includes(role.id))) { return message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is whitelisted, but you do not have any of the roles required to manage it.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is whitelisted, but you do not have any of the roles required to manage it.`, allowedMentions: AllowedMentions.none() }); } @@ -95,19 +95,19 @@ export default class RoleCommand extends BushCommand { if (!this.client.ownerID.includes(message.author.id)) { if (role.comparePositionTo(message.member.roles.highest) >= 0) { return message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is higher or equal to your highest role.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is higher or equal to your highest role.`, allowedMentions: AllowedMentions.none() }); } if (role.comparePositionTo(message.guild.me.roles.highest) >= 0) { return message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is higher or equal to my highest role.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is higher or equal to my highest role.`, allowedMentions: AllowedMentions.none() }); } if (role.managed) { await message.util.reply({ - content: `<:error:837123021016924261> <@&${role.id}> is managed by an integration and cannot be managed.`, + content: `${this.client.util.emojis.error} <@&${role.id}> is managed by an integration and cannot be managed.`, allowedMentions: AllowedMentions.none() }); } @@ -118,12 +118,12 @@ export default class RoleCommand extends BushCommand { await user.roles.remove(role.id); } catch { return message.util.reply({ - content: `<:error:837123021016924261> Could not remove <@&${role.id}> from <@${user.id}>.`, + content: `${this.client.util.emojis.error} Could not remove <@&${role.id}> from <@${user.id}>.`, allowedMentions: AllowedMentions.none() }); } return message.util.reply({ - content: `<:checkmark:837109864101707807> Successfully removed <@&${role.id}> from <@${user.id}>!`, + content: `${this.client.util.emojis.success} Successfully removed <@&${role.id}> from <@${user.id}>!`, allowedMentions: AllowedMentions.none() }); } else { @@ -131,12 +131,12 @@ export default class RoleCommand extends BushCommand { await user.roles.add(role.id); } catch { return message.util.reply({ - content: `<:error:837123021016924261> Could not add <@&${role.id}> to <@${user.id}>.`, + content: `${this.client.util.emojis.error} Could not add <@&${role.id}> to <@${user.id}>.`, allowedMentions: AllowedMentions.none() }); } return message.util.reply({ - content: `<:checkmark:837109864101707807> Successfully added <@&${role.id}> to <@${user.id}>!`, + content: `${this.client.util.emojis.success} Successfully added <@&${role.id}> to <@${user.id}>!`, allowedMentions: AllowedMentions.none() }); } |