diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-17 10:25:46 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-17 10:25:46 -0400 |
commit | d1724227abfb8f0fcd9e573f7e9772cf0be8257a (patch) | |
tree | 52c9dbae1fbbbd3c777d9c16ab643c477141ae21 /src/commands/moderation | |
parent | 53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3 (diff) | |
download | tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.tar.gz tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.tar.bz2 tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.zip |
honestly no idea what I did at this point
Diffstat (limited to 'src/commands/moderation')
-rw-r--r-- | src/commands/moderation/ban.ts | 15 | ||||
-rw-r--r-- | src/commands/moderation/kick.ts | 13 | ||||
-rw-r--r-- | src/commands/moderation/lockdown.ts | 45 | ||||
-rw-r--r-- | src/commands/moderation/modlog.ts | 2 | ||||
-rw-r--r-- | src/commands/moderation/mute.ts | 10 | ||||
-rw-r--r-- | src/commands/moderation/warn.ts | 10 |
6 files changed, 86 insertions, 9 deletions
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index c5833fc..874d5ed 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -37,6 +37,11 @@ export default class BanCommand extends BushCommand { match: 'option', type: Argument.range('integer', 0, 7, true), default: 0 + }, + { + id: 'force', + flag: '--force', + match: 'flag' } ], slash: true, @@ -77,10 +82,16 @@ export default class BanCommand extends BushCommand { } async exec( message: BushMessage | BushSlashMessage, - { user, reason, days }: { user: User; reason?: { duration: number; contentWithoutTime: string }; days?: number } + { + user, + reason, + days, + force + }: { user: User; reason?: { duration: number; contentWithoutTime: string }; days?: number; force: boolean } ): Promise<unknown> { const member = message.guild.members.cache.get(user.id) as BushGuildMember; - const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'ban'); + const useForce = force && message.author.isOwner(); + const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'ban', true, useForce); if (canModerateResponse !== true) { return message.util.reply(canModerateResponse); diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index ccf35a9..74ace94 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -28,6 +28,11 @@ export default class KickCommand extends BushCommand { retry: '{error} Choose a valid kick reason.', optional: true } + }, + { + id: 'force', + flag: '--force', + match: 'flag' } ], slash: true, @@ -50,9 +55,13 @@ export default class KickCommand extends BushCommand { }); } - async exec(message: BushMessage | BushSlashMessage, { user, reason }: { user: BushUser; reason?: string }): Promise<unknown> { + 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; - const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'kick'); + const useForce = force && message.author.isOwner(); + const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'kick', true, useForce); if (canModerateResponse !== true) { return message.util.reply(canModerateResponse); diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts new file mode 100644 index 0000000..e67d110 --- /dev/null +++ b/src/commands/moderation/lockdown.ts @@ -0,0 +1,45 @@ +import { BushCommand, BushMessage, BushNewsChannel, BushSlashMessage, BushTextChannel } from '@lib'; + +export default class LockdownCommand extends BushCommand { + public constructor() { + super('lockdown', { + aliases: ['lockdown', 'unlockdown'], + category: 'moderation', + description: { + content: 'Allows you to lockdown a channel or all configured channels..', + usage: 'lockdown [--all]', + examples: ['lockdown', 'lockdown --all'] + }, + args: [ + { + id: 'all', + type: 'flag', + flag: '--all' + } + ], + slash: true, + slashOptions: [ + { + name: 'all', + description: 'Would you like to lockdown all channels?', + type: 'BOOLEAN', + required: false + } + ], + channel: 'guild', + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES'] + }); + } + public async exec(message: BushMessage | BushSlashMessage, { all }: { all: boolean }): Promise<unknown> { + return await message.util.reply('no'); + if (!all) { + if (!['GUILD_TEXT', 'GUILD_NEWS'].includes(message.channel.type)) + return message.util.reply(`${this.client.util.emojis.error} You can only lock down text and announcement channels.`); + const lockdownSuccess = await this.client.util.lockdownChannel({ + channel: message.channel as BushTextChannel | BushNewsChannel, + moderator: message.author + }); + } + } +} diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 4b57a4f..e3da45f 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -72,7 +72,7 @@ export default class ModlogCommand extends BushCommand { color: this.client.util.colors.default }) ); - this.client.util.buttonPaginate(message, embedPages, '', true); + return await this.client.util.buttonPaginate(message, embedPages, '', true); } else if (search) { const entry = await ModLog.findByPk(search as string); if (!entry) return message.util.send(`${this.client.util.emojis.error} That modlog does not exist.`); diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 7443c55..2004eb8 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -29,6 +29,11 @@ export default class MuteCommand extends BushCommand { retry: '{error} Choose a valid mute reason and duration.', optional: true } + }, + { + id: 'force', + flag: '--force', + match: 'flag' } ], slash: true, @@ -53,11 +58,12 @@ export default class MuteCommand extends BushCommand { } async exec( message: BushMessage | BushSlashMessage, - { user, reason }: { user: BushUser; reason?: { duration: number; contentWithoutTime: string } } + { user, reason, force }: { user: BushUser; reason?: { duration: number; contentWithoutTime: string }; force: boolean } ): Promise<unknown> { const error = this.client.util.emojis.error; const member = message.guild.members.cache.get(user.id) as BushGuildMember; - const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'mute'); + const useForce = force && message.author.isOwner(); + const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'mute', true, useForce); const victimBoldTag = `**${member.user.tag}**`; if (canModerateResponse !== true) { diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index 3d353ca..d5bf009 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -28,6 +28,11 @@ export default class WarnCommand extends BushCommand { retry: '{error} Choose a valid warn reason.', optional: true } + }, + { + id: 'force', + flag: '--force', + match: 'flag' } ], slash: true, @@ -52,10 +57,11 @@ export default class WarnCommand extends BushCommand { } public async exec( message: BushMessage | BushSlashMessage, - { user, reason }: { user: BushUser; reason: string } + { user, reason, force }: { user: BushUser; reason: string; force: boolean } ): Promise<unknown> { const member = message.guild.members.cache.get(user.id) as BushGuildMember; - const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'warn'); + const useForce = force && message.author.isOwner(); + const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'warn', true, useForce); const victimBoldTag = `**${member.user.tag}**`; if (canModerateResponse !== true) { |