diff options
Diffstat (limited to 'src/commands/moderation')
-rw-r--r-- | src/commands/moderation/_lockdown.ts | 4 | ||||
-rw-r--r-- | src/commands/moderation/ban.ts | 10 | ||||
-rw-r--r-- | src/commands/moderation/evidence.ts | 4 | ||||
-rw-r--r-- | src/commands/moderation/hideCase.ts | 9 | ||||
-rw-r--r-- | src/commands/moderation/kick.ts | 4 | ||||
-rw-r--r-- | src/commands/moderation/modlog.ts | 4 | ||||
-rw-r--r-- | src/commands/moderation/mute.ts | 10 | ||||
-rw-r--r-- | src/commands/moderation/purge.ts | 19 | ||||
-rw-r--r-- | src/commands/moderation/removeReactionEmoji.ts | 4 | ||||
-rw-r--r-- | src/commands/moderation/role.ts | 4 | ||||
-rw-r--r-- | src/commands/moderation/slowmode.ts | 4 | ||||
-rw-r--r-- | src/commands/moderation/unban.ts | 7 | ||||
-rw-r--r-- | src/commands/moderation/unmute.ts | 4 | ||||
-rw-r--r-- | src/commands/moderation/warn.ts | 4 |
14 files changed, 49 insertions, 42 deletions
diff --git a/src/commands/moderation/_lockdown.ts b/src/commands/moderation/_lockdown.ts index 0086ff6..34d5698 100644 --- a/src/commands/moderation/_lockdown.ts +++ b/src/commands/moderation/_lockdown.ts @@ -7,7 +7,7 @@ export default class LockdownCommand extends BushCommand { category: 'moderation', description: { content: 'Allows you to lockdown a channel or all configured channels..', - usage: 'lockdown [--all]', + usage: ['lockdown [--all]'], examples: ['lockdown', 'lockdown --all'] }, args: [ @@ -33,7 +33,7 @@ export default class LockdownCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { all: boolean }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { all: boolean }) { return await message.util.reply('Unfortunately my developer is too lazy to implement this command.'); if (!args.all) { if (!['GUILD_TEXT', 'GUILD_NEWS'].includes(message.channel!.type)) diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index a267b78..5569069 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -8,7 +8,7 @@ export default class BanCommand extends BushCommand { category: 'moderation', description: { content: 'Ban a member from the server.', - usage: 'ban <member> <reason> [--delete ]', + usage: ['ban <member> <reason> [--delete]'], examples: ['ban ironm00n 1 day commands in #general --delete 7'] }, args: [ @@ -83,12 +83,12 @@ export default class BanCommand extends BushCommand { message: BushMessage | BushSlashMessage, args: { user: User | Snowflake; - reason?: { duration: number | null; contentWithoutTime: string }; - days?: number; + reason: { duration: number | null; contentWithoutTime: string } | null; + days: number | null; force: boolean; } - ): Promise<unknown> { - if (typeof args.reason === 'object') args.reason.duration ??= 0; + ) { + if (args.reason && typeof args.reason === 'object') args.reason.duration ??= 0; args.days ??= 0; if (!message.guild) return message.util.reply(`${util.emojis.error} This command cannot be used in dms.`); diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts index a681bc1..0a297de 100644 --- a/src/commands/moderation/evidence.ts +++ b/src/commands/moderation/evidence.ts @@ -8,7 +8,7 @@ export default class EvidenceCommand extends BushCommand { category: 'moderation', description: { content: 'Add evidence to a modlog case.', - usage: 'evidence <case_id> <evidence>', + usage: ['evidence <case_id> <evidence>'], examples: ['evidence '] }, slash: true, @@ -60,7 +60,7 @@ export default class EvidenceCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { case_id: caseID, evidence }: { case_id: string; evidence?: string } - ): Promise<unknown> { + ) { const entry = await ModLog.findByPk(caseID); if (!entry || entry.pseudo) return message.util.send(`${util.emojis.error} Invalid modlog entry.`); if (entry.guild !== message.guild!.id) diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts index 981a8bc..a873784 100644 --- a/src/commands/moderation/hideCase.ts +++ b/src/commands/moderation/hideCase.ts @@ -7,8 +7,8 @@ export default class HideCaseCommand extends BushCommand { category: 'moderation', description: { content: 'Hide a particular modlog case from the modlog command unless the `--hidden` flag is specified', - usage: 'hideCase <case_id>', - examples: ['hideCase 9210b1ea-91f5-4ea2-801b-02b394469c77'] + usage: ['hide-case <case_id>'], + examples: ['hide-case 9210b1ea-91f5-4ea2-801b-02b394469c77'] }, args: [ { @@ -35,10 +35,7 @@ export default class HideCaseCommand extends BushCommand { }); } - public override async exec( - message: BushMessage | BushSlashMessage, - { case_id: caseID }: { case_id: string } - ): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, { case_id: caseID }: { case_id: string }) { const entry = await ModLog.findByPk(caseID); if (!entry || entry.pseudo) return message.util.send(`${util.emojis.error} Invalid entry.`); if (entry.guild !== message.guild!.id) diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index d4edb07..34c1b76 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -7,7 +7,7 @@ export default class KickCommand extends BushCommand { category: 'moderation', description: { content: 'Kick a user.', - usage: 'kick <member> <reason>', + usage: ['kick <member> <reason>'], examples: ['kick @user bad'] }, args: [ @@ -58,7 +58,7 @@ export default class KickCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason?: string; force: boolean } - ): Promise<unknown> { + ) { const member = await message.guild!.members.fetch(user.id); if (!member) diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 6840f4e..2bd0f5a 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -8,7 +8,7 @@ export default class ModlogCommand extends BushCommand { category: 'moderation', description: { content: "View a user's modlogs, or view a specific case.", - usage: 'modlogs <search> [--hidden]', + usage: ['modlogs <search> [--hidden]'], examples: ['modlogs @Tyman'] }, args: [ @@ -62,7 +62,7 @@ export default class ModlogCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { search, hidden }: { search: BushUser | string; hidden: boolean } - ): Promise<unknown> { + ) { const foundUser = search instanceof User ? search : await util.resolveUserAsync(search); if (foundUser) { const logs = await ModLog.findAll({ diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 897e95a..844809b 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -7,7 +7,7 @@ export default class MuteCommand extends BushCommand { category: 'moderation', description: { content: 'Mute a user.', - usage: 'mute <member> [reason] [duration]', + usage: ['mute <member> [reason] [duration]'], examples: ['mute ironm00n 1 day commands in #general'] }, args: [ @@ -29,7 +29,11 @@ export default class MuteCommand extends BushCommand { optional: true } }, - { id: 'force', flag: '--force', match: 'flag' } + { + id: 'force', + flag: '--force', + match: 'flag' + } ], slash: true, slashOptions: [ @@ -55,7 +59,7 @@ export default class MuteCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, args: { user: BushUser; reason?: { duration: number | null; contentWithoutTime: string } | string; force: boolean } - ): Promise<unknown> { + ) { const reason: { duration: number | null; contentWithoutTime: string } = args.reason ? typeof args.reason === 'string' ? await util.arg.cast('contentWithDuration', message, args.reason) diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts index 472665c..e5fea8e 100644 --- a/src/commands/moderation/purge.ts +++ b/src/commands/moderation/purge.ts @@ -8,8 +8,8 @@ export default class PurgeCommand extends BushCommand { category: 'moderation', description: { content: 'A command to mass delete messages.', - usage: 'purge <amount>', - examples: ['Purge 20'] + usage: ['purge <amount>'], + examples: ['purge 20'] }, args: [ { @@ -25,11 +25,20 @@ export default class PurgeCommand extends BushCommand { match: 'flag', flag: '--bot' }, - { id: 'user', match: 'option', flag: '--user' } + { + id: 'user', + match: 'option', + flag: '--user' + } ], slash: true, slashOptions: [ - { name: 'amount', description: 'How many messages would you like to purge?', type: 'INTEGER', required: true }, + { + name: 'amount', + description: 'How many messages would you like to purge?', + type: 'INTEGER', + required: true + }, { name: 'bot', description: 'Would you like to only delete messages that are from bots?', @@ -43,7 +52,7 @@ export default class PurgeCommand extends BushCommand { }); } - public override async exec(message: BushMessage, args: { amount: number; bot: boolean }): Promise<unknown> { + public override async exec(message: BushMessage, args: { amount: number; bot: boolean }) { if (message.channel.type === 'DM') return message.util.reply(`${util.emojis.error} You cannot run this command in dms.`); if (args.amount > 100 || args.amount < 1) return message.util.reply(`${util.emojis.error} `); diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts index 63e20bd..3e14aa2 100644 --- a/src/commands/moderation/removeReactionEmoji.ts +++ b/src/commands/moderation/removeReactionEmoji.ts @@ -8,7 +8,7 @@ export default class RemoveReactionEmojiCommand extends BushCommand { category: 'moderation', description: { content: 'Deleted all the reactions of a certain emoji from a message.', - usage: 'remove-reaction-emoji <message> <emoji>', + usage: ['remove-reaction-emoji <message> <emoji>'], examples: ['remove-reaction-emoji 791413052347252786 <:omegaclown:782630946435366942>'] }, args: [ @@ -39,7 +39,7 @@ export default class RemoveReactionEmojiCommand extends BushCommand { public override async exec( message: BushMessage, { messageToRemoveFrom, emoji }: { messageToRemoveFrom: BushMessage; emoji: Emoji | Snowflake } - ): Promise<unknown> { + ) { const id = !['string'].includes(typeof emoji); const emojiID = !id ? `${emoji}` : (emoji as Emoji).id; const success = await messageToRemoveFrom.reactions.cache diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index d6a85af..a0d6518 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -8,7 +8,7 @@ export default class RoleCommand extends BushCommand { category: 'moderation', description: { content: "Manages users' roles.", - usage: 'role <add|remove> <user> <role> [duration]', + usage: ['role <add|remove> <user> <role> [duration]'], examples: ['role add spammer nogiveaways 7days', 'ra tyman muted', 'rr tyman staff'] }, slash: true, @@ -95,7 +95,7 @@ export default class RoleCommand extends BushCommand { role, duration }: { action: 'add' | 'remove'; user: BushGuildMember; role: BushRole; duration?: number | null } - ): Promise<unknown> { + ) { if (duration === null) duration = 0; if ( !message.member!.permissions.has('MANAGE_ROLES') && diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 75d795c..4192ecf 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -9,7 +9,7 @@ export default class SlowModeCommand extends BushCommand { category: 'moderation', description: { content: 'A command to set the slowmode of a channel.', - usage: 'slowmode <length>', + usage: ['slowmode <length>'], examples: ['slowmode 3'] }, args: [ @@ -56,7 +56,7 @@ export default class SlowModeCommand extends BushCommand { length: number | 'off' | 'none' | 'disable'; channel: TextChannel | ThreadChannel | BushTextChannel | BushNewsChannel | BushThreadChannel | NewsChannel; } - ): Promise<unknown> { + ) { if (message.channel!.type === 'DM') return await message.util.reply(`${util.emojis.error} This command cannot be run in dms.`); if (!channel) channel = message.channel as any; diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index 9d52dd2..3d61e82 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -7,7 +7,7 @@ export default class UnbanCommand extends BushCommand { category: 'moderation', description: { content: 'Unban a member from the server.', - usage: 'unban <member> <reason> [--delete ]', + usage: ['unban <member> <reason> [--delete]'], examples: ['unban 322862723090219008 I changed my mind, commands are allowed in #general'] }, args: [ @@ -50,10 +50,7 @@ export default class UnbanCommand extends BushCommand { userPermissions: ['BAN_MEMBERS'] }); } - public override async exec( - message: BushMessage | BushSlashMessage, - { user, reason }: { user: BushUser; reason?: string } - ): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, { user, reason }: { user: BushUser; reason?: string }) { const responseCode = await message.guild!.bushUnban({ user, moderator: message.author, diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index 3b4f5bd..ca7861c 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -7,7 +7,7 @@ export default class UnmuteCommand extends BushCommand { category: 'moderation', description: { content: 'unmute a user.', - usage: 'unmute <member> [reason]', + usage: ['unmute <member> [reason]'], examples: ['unmute 322862723090219008 1 day commands in #general'] }, args: [ @@ -59,7 +59,7 @@ export default class UnmuteCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason?: string; force: boolean } - ): Promise<unknown> { + ) { const error = util.emojis.error; const member = message.guild!.members.cache.get(user.id) as BushGuildMember; diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index c510929..d326806 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -7,7 +7,7 @@ export default class WarnCommand extends BushCommand { category: 'moderation', description: { content: 'Warn a user.', - usage: 'warn <member> [reason]', + usage: ['warn <member> [reason]'], examples: ['warn @Tyman being cool'] }, args: [ @@ -58,7 +58,7 @@ export default class WarnCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason: string; force: boolean } - ): Promise<unknown> { + ) { const member = message.guild!.members.cache.get(user.id) as BushGuildMember; if (!member) return message.util.reply(`${util.emojis.error} I cannot warn users that are not in the server.`); const useForce = force && message.author.isOwner(); |