From 53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Wed, 14 Jul 2021 21:22:09 -0400 Subject: started moving over some other commands --- src/commands/config/autoPublishChannel.ts | 53 +++++++++++++++++++++++++++++++ src/commands/config/muteRole.ts | 7 ++-- src/commands/config/prefix.ts | 7 ++-- src/commands/config/punishmentFooter.ts | 7 ++-- src/commands/config/welcomeChannel.ts | 7 ++-- 5 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 src/commands/config/autoPublishChannel.ts (limited to 'src/commands/config') 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 ', + 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 { + 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 ', 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 { -- cgit