diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-14 21:22:09 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-14 21:22:09 -0400 |
commit | 53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3 (patch) | |
tree | f95f23aad382879b35860d4d3be3642068fac8a2 /src/commands/config | |
parent | eaaae08aeee1fa16a4e1ad0b26fceb42885bfcde (diff) | |
download | tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.tar.gz tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.tar.bz2 tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.zip |
started moving over some other commands
Diffstat (limited to 'src/commands/config')
-rw-r--r-- | src/commands/config/autoPublishChannel.ts | 53 | ||||
-rw-r--r-- | src/commands/config/muteRole.ts | 7 | ||||
-rw-r--r-- | src/commands/config/prefix.ts | 7 | ||||
-rw-r--r-- | src/commands/config/punishmentFooter.ts | 7 | ||||
-rw-r--r-- | src/commands/config/welcomeChannel.ts | 7 |
5 files changed, 69 insertions, 12 deletions
diff --git a/src/commands/config/autoPublishChannel.ts b/src/commands/config/autoPublishChannel.ts new file mode 100644 index 0000000..421e030 --- /dev/null +++ b/src/commands/config/autoPublishChannel.ts @@ -0,0 +1,53 @@ +import { BushCommand, BushMessage } from '@lib'; +import { Channel } from 'discord.js'; + +export default class AutoPublishChannelCommand extends BushCommand { + public constructor() { + super('autopublishchannel', { + aliases: ['autopublishchannel', 'apc', 'publishchannel', 'autopublishchannels', 'publishchannels', 'autopublish'], + category: 'config', + description: { + content: 'A command to add/remove channels from being automatically published.', + usage: 'autopublishchannel <channel>', + examples: ['autopublishchannel #github'] + }, + args: [ + { + id: 'channel', + type: 'channel', + match: 'content', + prompt: { + start: 'What channel would you like to toggle auto publishing in?', + retry: '{error} Choose a valid channel.', + optional: false + } + } + ], + slash: true, + slashOptions: [ + { + name: 'channel', + description: 'What channel would you like me to send welcome messages in?', + type: 'CHANNEL', + required: false + } + ], + channel: 'guild', + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['MANAGE_GUILD', 'SEND_MESSAGES'] + }); + } + + public async exec(message: BushMessage, { channel }: { channel: Channel }): Promise<unknown> { + const autoPublishChannels = await message.guild.getSetting('autoPublishChannels'); + autoPublishChannels.includes(channel.id) + ? autoPublishChannels.splice(autoPublishChannels.indexOf(channel.id), 1) + : autoPublishChannels.push(channel.id); + await message.guild.setSetting('autoPublishChannels', autoPublishChannels); + return await message.util.reply( + `${this.client.util.emojis.success} Successfully ${ + autoPublishChannels.includes(channel.id) ? 'disabled' : 'enabled' + } auto publishing in <#${channel.id}>.` + ); + } +} diff --git a/src/commands/config/muteRole.ts b/src/commands/config/muteRole.ts index 1bec4a9..9074a1d 100644 --- a/src/commands/config/muteRole.ts +++ b/src/commands/config/muteRole.ts @@ -11,8 +11,6 @@ export default class MuteRoleCommand extends BushCommand { usage: 'muterole <role>', examples: ['muterole 748912426581229690'] }, - clientPermissions: ['SEND_MESSAGES'], - userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'], args: [ { id: 'role', @@ -32,7 +30,10 @@ export default class MuteRoleCommand extends BushCommand { type: 'ROLE', required: true } - ] + ], + channel: 'guild', + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } diff --git a/src/commands/config/prefix.ts b/src/commands/config/prefix.ts index 4624e99..79956be 100644 --- a/src/commands/config/prefix.ts +++ b/src/commands/config/prefix.ts @@ -10,8 +10,6 @@ export default class PrefixCommand extends BushCommand { usage: 'prefix [prefix]', examples: ['prefix', 'prefix -'] }, - clientPermissions: ['SEND_MESSAGES'], - userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'], args: [ { id: 'prefix', @@ -31,7 +29,10 @@ export default class PrefixCommand extends BushCommand { type: 'STRING', required: false } - ] + ], + channel: 'guild', + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } diff --git a/src/commands/config/punishmentFooter.ts b/src/commands/config/punishmentFooter.ts index 3a246df..6b2759a 100644 --- a/src/commands/config/punishmentFooter.ts +++ b/src/commands/config/punishmentFooter.ts @@ -11,8 +11,6 @@ export default class PunishmentFooterCommand extends BushCommand { usage: 'punishmentfooter [message]', examples: ['punishmentfooter', 'prefix you can appeal at https://example.com.'] }, - clientPermissions: ['SEND_MESSAGES'], - userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'], args: [ { id: 'ending', @@ -33,7 +31,10 @@ export default class PunishmentFooterCommand extends BushCommand { type: 'STRING', required: false } - ] + ], + channel: 'guild', + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } diff --git a/src/commands/config/welcomeChannel.ts b/src/commands/config/welcomeChannel.ts index 71d59f8..488a0a9 100644 --- a/src/commands/config/welcomeChannel.ts +++ b/src/commands/config/welcomeChannel.ts @@ -11,8 +11,6 @@ export default class WelcomeChannelCommand extends BushCommand { usage: 'welcomechannel [channel]', examples: ['welcomechannel #welcome'] }, - clientPermissions: ['SEND_MESSAGES'], - userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'], args: [ { id: 'channel', @@ -32,7 +30,10 @@ export default class WelcomeChannelCommand extends BushCommand { type: 'CHANNEL', required: false } - ] + ], + channel: 'guild', + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } public async exec(message: BushMessage | BushSlashMessage, args: { channel: Channel }): Promise<unknown> { |