diff options
-rw-r--r-- | src/commands/admin/channelPermissions.ts | 2 | ||||
-rw-r--r-- | src/commands/config/autoPublishChannel.ts | 48 | ||||
-rw-r--r-- | src/commands/config/features.ts | 3 | ||||
-rw-r--r-- | src/commands/config/joinRoles.ts | 39 | ||||
-rw-r--r-- | src/commands/config/muteRole.ts | 34 | ||||
-rw-r--r-- | src/commands/config/prefix.ts | 43 | ||||
-rw-r--r-- | src/commands/config/punishmentFooter.ts | 39 | ||||
-rw-r--r-- | src/commands/config/welcomeChannel.ts | 38 | ||||
-rw-r--r-- | src/commands/dev/servers.ts | 2 | ||||
-rw-r--r-- | src/commands/dev/sh.ts | 1 | ||||
-rw-r--r-- | src/commands/dev/superUser.ts | 2 | ||||
-rw-r--r-- | src/commands/dev/test.ts | 1 | ||||
-rw-r--r-- | src/commands/leveling/leaderboard.ts | 4 | ||||
-rw-r--r-- | src/commands/leveling/level.ts | 5 | ||||
-rw-r--r-- | src/commands/moulberry-bush/serverStatus.ts (renamed from src/commands/utilities/serverStatus.ts) | 2 | ||||
-rw-r--r-- | src/listeners/client/interactionCreate.ts | 16 |
16 files changed, 52 insertions, 227 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index 83230f7..ea97343 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -3,7 +3,7 @@ import { BushCommand, BushMessage } from '../../lib'; export default class ChannelPermissionsCommand extends BushCommand { public constructor() { - super('channelpermissions', { + super('channelPermissions', { aliases: ['channelperms', 'cperms', 'cperm', 'chanperms', 'chanperm', 'channelpermissions'], category: 'admin', typing: true, diff --git a/src/commands/config/autoPublishChannel.ts b/src/commands/config/autoPublishChannel.ts index a58f32f..d691a7f 100644 --- a/src/commands/config/autoPublishChannel.ts +++ b/src/commands/config/autoPublishChannel.ts @@ -1,59 +1,23 @@ -import { AllowedMentions, BushCommand, BushMessage } from '@lib'; -import { Channel } from 'discord.js'; +import { BushCommand, BushMessage } from '@lib'; export default class AutoPublishChannelCommand extends BushCommand { public constructor() { - super('autopublishchannel', { + super('autoPublishChannel', { aliases: ['autopublishchannel', 'apc', 'publishchannel', 'autopublishchannels', 'publishchannels', 'autopublish'], category: 'config', description: { - content: 'A command to add/remove channels from being automatically published.', + content: 'This command has been deprecated, please use the config command instead', 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: true - } - ], channel: 'guild', + hidden: true, clientPermissions: ['SEND_MESSAGES'], userPermissions: ['MANAGE_GUILD', 'SEND_MESSAGES'] }); } - public override async exec(message: BushMessage, { channel }: { channel: Channel }): Promise<unknown> { - const autoPublishChannels = await message.guild!.getSetting('autoPublishChannels'); - const newValue = util.addOrRemoveFromArray( - autoPublishChannels.includes(channel.id) ? 'remove' : 'add', - autoPublishChannels, - channel.id - ); - await message.guild!.setSetting('autoPublishChannels', newValue); - client.logger.debugRaw(autoPublishChannels); - client.logger.debugRaw(channel.id); - client.logger.debugRaw(autoPublishChannels.includes(channel.id)); - return await message.util.reply({ - content: `${util.emojis.success} Successfully ${ - autoPublishChannels.includes(channel.id) ? 'enabled' : 'disabled' - } auto publishing in <#${channel.id}>.`, - allowedMentions: AllowedMentions.none() - }); + public override async exec(message: BushMessage): Promise<unknown> { + return message.util.reply(`${util.emojis.error} 'This command has been deprecated, please use the config command instead'`); } } diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index 9a5fa5b..7a7c3bb 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -14,8 +14,7 @@ export default class FeaturesCommand extends BushCommand { slash: true, channel: 'guild', clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'], - userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'], - ownerOnly: true + userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { diff --git a/src/commands/config/joinRoles.ts b/src/commands/config/joinRoles.ts index 0b9ac21..2a3031e 100644 --- a/src/commands/config/joinRoles.ts +++ b/src/commands/config/joinRoles.ts @@ -1,5 +1,4 @@ -import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib'; -import { Role } from 'discord.js'; +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; export default class JoinRolesCommand extends BushCommand { public constructor() { @@ -7,46 +6,18 @@ export default class JoinRolesCommand extends BushCommand { aliases: ['joinroles', 'joinrole', 'jr'], category: 'config', description: { - content: 'Configure what roles to assign to someone when they join the server.', + content: 'This command has been deprecated, please use the config command instead', usage: 'joinroles <role>', examples: ['joinroles @member'] }, - args: [ - { - id: 'role', - type: 'role', - prompt: { - start: 'What role would you like me to assign to users when they join the server?', - retry: '{error} Choose a valid role', - optional: true - } - } - ], - slash: true, - slashOptions: [ - { - name: 'role', - description: 'What role would you like me to assign to users when they join the server?', - type: 'ROLE', - required: false - } - ], channel: 'guild', + hidden: true, clientPermissions: ['SEND_MESSAGES'], userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } - public override async exec(message: BushMessage | BushSlashMessage, { role }: { role: Role }): Promise<unknown> { - const joinRoles = await message.guild!.getSetting('joinRoles'); - const includes = joinRoles.includes(role.id); - const newValue = util.addOrRemoveFromArray(includes ? 'remove' : 'add', joinRoles, role.id); - await message.guild!.setSetting('joinRoles', newValue); - return await message.util.reply({ - content: `${util.emojis.success} Successfully ${includes ? 'removed' : 'added'} <@&${role.id}> ${ - includes ? 'from' : 'to' - }from being assigned to members when they join the server.`, - allowedMentions: AllowedMentions.none() - }); + public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + return message.util.reply(`${util.emojis.error} 'This command has been deprecated, please use the config command instead'`); } } diff --git a/src/commands/config/muteRole.ts b/src/commands/config/muteRole.ts index c7a6e75..6d3c9f6 100644 --- a/src/commands/config/muteRole.ts +++ b/src/commands/config/muteRole.ts @@ -1,5 +1,4 @@ -import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib'; -import { Role } from 'discord.js'; +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; export default class MuteRoleCommand extends BushCommand { public constructor() { @@ -7,41 +6,18 @@ export default class MuteRoleCommand extends BushCommand { aliases: ['muterole'], category: 'config', description: { - content: 'Configure what role to use when muting users.', + content: 'This command has been deprecated, please use the config command instead', usage: 'muterole <role>', examples: ['muterole 748912426581229690'] }, - args: [ - { - id: 'role', - type: 'role', - prompt: { - start: "What would you like to set the server's mute role to?", - retry: '{error} Choose a valid role.', - optional: false - } - } - ], - slash: true, - slashOptions: [ - { - name: 'role', - description: "What would you like to set the server's mute role to?", - type: 'ROLE', - required: true - } - ], channel: 'guild', + hidden: true, clientPermissions: ['SEND_MESSAGES'], userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } - override async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<void> { - await message.guild!.setSetting('muteRole', args.role.id); - await message.util.send({ - content: `${util.emojis.success} Changed the server's mute role to <@&${args.role.id}>.`, - allowedMentions: AllowedMentions.none() - }); + override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + return message.util.reply(`${util.emojis.error} 'This command has been deprecated, please use the config command instead'`); } } diff --git a/src/commands/config/prefix.ts b/src/commands/config/prefix.ts index 9d707e0..5cd75b3 100644 --- a/src/commands/config/prefix.ts +++ b/src/commands/config/prefix.ts @@ -1,4 +1,4 @@ -import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib'; +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; export default class PrefixCommand extends BushCommand { public constructor() { @@ -6,51 +6,18 @@ export default class PrefixCommand extends BushCommand { aliases: ['prefix'], category: 'config', description: { - content: 'Set or reset the prefix for the server.', + content: 'This command has been deprecated, please use the config command instead', usage: 'prefix [prefix]', examples: ['prefix', 'prefix -'] }, - args: [ - { - id: 'prefix', - type: 'string', - prompt: { - start: 'What would you like the new prefix to be?', - retry: '{error} Choose a valid prefix', - optional: true - } - } - ], - slash: true, - slashOptions: [ - { - name: 'prefix', - description: 'What would you like the new prefix to be?', - type: 'STRING', - required: false - } - ], channel: 'guild', + hidden: true, clientPermissions: ['SEND_MESSAGES'], userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } - override async exec(message: BushMessage | BushSlashMessage, args: { prefix?: string }): Promise<unknown> { - const oldPrefix = await message.guild!.getSetting('prefix'); - await message.guild!.setSetting('prefix', args.prefix ?? client.config.prefix); - if (args.prefix) { - return await message.util.send({ - content: `${util.emojis.success} changed the server's prefix ${oldPrefix ? `from \`${oldPrefix}\`` : ''} to \`${ - args.prefix - }\`.`, - allowedMentions: AllowedMentions.none() - }); - } else { - return await message.util.send({ - content: `${util.emojis.success} reset the server's prefix to \`${client.config.prefix}\`.`, - allowedMentions: AllowedMentions.none() - }); - } + override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + return message.util.reply(`${util.emojis.error} 'This command has been deprecated, please use the config command instead'`); } } diff --git a/src/commands/config/punishmentFooter.ts b/src/commands/config/punishmentFooter.ts index d07ce4f..79e3df3 100644 --- a/src/commands/config/punishmentFooter.ts +++ b/src/commands/config/punishmentFooter.ts @@ -1,5 +1,4 @@ -import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib'; -import { Util } from 'discord.js'; +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; export default class PunishmentFooterCommand extends BushCommand { public constructor() { @@ -7,46 +6,18 @@ export default class PunishmentFooterCommand extends BushCommand { aliases: ['punishmentfooter'], category: 'config', description: { - content: 'Configure or reset what should follow all punishment related dms.', + content: 'This command has been deprecated, please use the config command instead', usage: 'punishmentfooter [message]', examples: ['punishmentfooter', 'prefix you can appeal at https://example.com.'] }, - args: [ - { - id: 'ending', - type: 'string', - match: 'restContent', - prompt: { - start: 'What message would you like to follow punishment dms?', - retry: '{error} Choose a valid role.', - optional: true - } - } - ], - slash: true, - slashOptions: [ - { - name: 'ending', - description: 'What message would you like to follow punishment dms?', - type: 'STRING', - required: false - } - ], channel: 'guild', + hidden: true, clientPermissions: ['SEND_MESSAGES'], userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } - override async exec(message: BushMessage | BushSlashMessage, args: { ending: string }): Promise<unknown> { - await message.guild!.setSetting('punishmentEnding', args.ending || ''); - if (args.ending) - return await message.util.send({ - content: `${util.emojis.success} Changed the server's punishment footer to \n\`\`\`${Util.cleanCodeBlockContent( - args.ending - )}\`\`\`.`, - allowedMentions: AllowedMentions.none() - }); - else return await message.util.send(`${util.emojis.success} Removed he server's punishment footer.`); + override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + return message.util.reply(`${util.emojis.error} 'This command has been deprecated, please use the config command instead'`); } } diff --git a/src/commands/config/welcomeChannel.ts b/src/commands/config/welcomeChannel.ts index fc56607..c94b416 100644 --- a/src/commands/config/welcomeChannel.ts +++ b/src/commands/config/welcomeChannel.ts @@ -1,5 +1,4 @@ import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; -import { Channel } from 'discord.js'; export default class WelcomeChannelCommand extends BushCommand { public constructor() { @@ -7,46 +6,17 @@ export default class WelcomeChannelCommand extends BushCommand { aliases: ['welcomechannel', 'wc'], category: 'config', description: { - content: 'Configure the what channel you want BushBot to send a message in when someone joins the server.', + content: 'This command has been deprecated, please use the config command instead', usage: 'welcomechannel [channel]', examples: ['welcomechannel #welcome'] }, - args: [ - { - id: 'channel', - type: 'channel', - prompt: { - start: 'What channel would you like me to send welcome messages in?', - retry: '{error} Choose a valid channel', - optional: true - } - } - ], - slash: true, - slashOptions: [ - { - name: 'channel', - description: 'What channel would you like me to send welcome messages in?', - type: 'CHANNEL', - required: false - } - ], channel: 'guild', + hidden: true, clientPermissions: ['SEND_MESSAGES'], userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'] }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { channel: Channel }): Promise<unknown> { - const oldChannel = await message.guild!.getSetting('welcomeChannel'); - await message.guild!.setSetting('welcomeChannel', args.channel.id ?? undefined); - if (args.channel) { - return await message.util.send( - `${util.emojis.success} changed the server's welcome channel ${oldChannel ? `from <#${oldChannel}>` : ''} to <#${ - args.channel.id - }>.` - ); - } else { - return await message.util.send(`${util.emojis.success} removed the server's welcome channel.`); - } + public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + return message.util.reply(`${util.emojis.error} 'This command has been deprecated, please use the config command instead'`); } } diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index d8799f5..c86e889 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -13,7 +13,7 @@ export default class ServersCommand extends BushCommand { }, clientPermissions: ['SEND_MESSAGES'], userPermissions: ['SEND_MESSAGES'], - superUserOnly: true + ownerOnly: true }); } diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index 025a308..93f0d40 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -11,6 +11,7 @@ const clean = (text: string | any) => { return (text = Util.cleanCodeBlockContent(text)); } else return text; }; + export default class ShCommand extends BushCommand { public constructor() { super('sh', { diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts index 1b2fd7c..4bab8a1 100644 --- a/src/commands/dev/superUser.ts +++ b/src/commands/dev/superUser.ts @@ -16,6 +16,7 @@ export default class SuperUserCommand extends BushCommand { ownerOnly: true }); } + *args(): IterableIterator<ArgumentOptions | Flag> { const action = yield { id: 'action', @@ -38,6 +39,7 @@ export default class SuperUserCommand extends BushCommand { }; return { action, user }; } + public override async exec( message: BushMessage | BushSlashMessage, args: { action: 'add' | 'remove'; user: User } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index aa421cd..bb0807b 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -29,7 +29,6 @@ export default class TestCommand extends BushCommand { }); } - // eslint-disable-next-line require-await public override async exec(message: BushMessage, args: { feature: string }): Promise<unknown> { const responses = [ 'Yes master.', diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index d29c15e..953a6c5 100644 --- a/src/commands/leveling/leaderboard.ts +++ b/src/commands/leveling/leaderboard.ts @@ -39,6 +39,10 @@ export default class LeaderboardCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage, args: { page: number }): Promise<unknown> { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`); + if (!(await message.guild.hasFeature('leveling'))) + return await message.util.reply( + `${util.emojis.error} This command can only be run in commands with the leveling feature enabled.` + ); const ranks = (await Level.findAll({ where: { guild: message.guild.id } })).sort((a, b) => b.xp - a.xp); const mapedRanks = ranks.map( (val, index) => `\`${index + 1}\` <@${val.user}> - Level ${val.level} (${val.xp.toLocaleString()} xp)` diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts index 6640744..f22ed8d 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -126,6 +126,11 @@ export default class LevelCommand extends BushCommand { } public override async exec(message: BushMessage | BushSlashMessage, args: { user?: BushUser }): Promise<unknown> { + if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`); + if (!(await message.guild.hasFeature('leveling'))) + return await message.util.reply( + `${util.emojis.error} This command can only be run in commands with the leveling feature enabled.` + ); const user = args.user ?? message.author; try { return await message.util.reply({ diff --git a/src/commands/utilities/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index 02db638..004329d 100644 --- a/src/commands/utilities/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -6,7 +6,7 @@ export default class ServerStatusCommand extends BushCommand { public constructor() { super('serverstatus', { aliases: ['serverstatus', 'ss'], - category: 'utilities', + category: "Moulberry's Bush", description: { usage: 'serverstatus', examples: ['serverstatus', 'ss'], diff --git a/src/listeners/client/interactionCreate.ts b/src/listeners/client/interactionCreate.ts index e755ad6..d07a084 100644 --- a/src/listeners/client/interactionCreate.ts +++ b/src/listeners/client/interactionCreate.ts @@ -12,17 +12,13 @@ export default class InteractionCreateListener extends BushListener { public override async exec(...[interaction]: BushClientEvents['interactionCreate']): Promise<unknown> { if (!interaction) return; + void client.console.verbose( + 'interactionVerbose', + `An interaction of type <<${interaction.type.toLowerCase().replaceAll('_', '')}>> was received from <<${ + interaction.user.tag + }>>.` + ); if (interaction.isCommand()) { - void client.console.info( - 'slashCommand', - `The <<${interaction.commandName}>> command was used by <<${interaction.user.tag}>> in <<${ - interaction.channel - ? interaction.channel.type == 'DM' - ? interaction.channel.recipient + 's DMs' - : interaction.channel.name - : 'unknown' - }>>.` - ); return; } else if (interaction.isButton()) { if (interaction.customId.startsWith('paginate_') || interaction.customId.startsWith('command_')) return; |