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/autoPublishChannel.ts | |
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/autoPublishChannel.ts')
-rw-r--r-- | src/commands/config/autoPublishChannel.ts | 53 |
1 files changed, 53 insertions, 0 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}>.` + ); + } +} |