From 1546da359646b89f13d17784eb7653a52ca61efd Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Thu, 27 May 2021 14:58:21 -0600 Subject: Fix file naming --- src/commands/server-config/prefix.ts | 71 +++++++++++++++++++++++++++++ src/commands/server-config/prefixCommand.ts | 71 ----------------------------- 2 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 src/commands/server-config/prefix.ts delete mode 100644 src/commands/server-config/prefixCommand.ts (limited to 'src/commands/server-config') diff --git a/src/commands/server-config/prefix.ts b/src/commands/server-config/prefix.ts new file mode 100644 index 0000000..cf70bd2 --- /dev/null +++ b/src/commands/server-config/prefix.ts @@ -0,0 +1,71 @@ +import { ApplicationCommandOptionType } from 'discord-api-types'; +import { CommandInteraction, Message, Guild as DiscordGuild } from 'discord.js'; +import { BushCommand } from '../../lib/extensions/BushCommand'; +import { SlashCommandOption } from '../../lib/extensions/Util'; +import { Guild } from '../../lib/models'; + +export default class PrefixCommand extends BushCommand { + constructor() { + super('prefix', { + aliases: ['prefix'], + category: 'server config', + args: [ + { + id: 'prefix' + } + ], + userPermissions: ['MANAGE_GUILD'], + description: { + content: + 'Set the prefix of the current server (resets to default if prefix is not given)', + usage: 'prefix [prefix]', + examples: ['prefix', 'prefix +'] + }, + slashCommandOptions: [ + { + type: ApplicationCommandOptionType.STRING, + name: 'prefix', + description: 'The prefix to set for this server', + required: false + } + ] + }); + } + + async changePrefix(guild: DiscordGuild, prefix?: string): Promise { + if (prefix) { + const row = await Guild.findByPk(guild.id); + row.prefix = prefix; + await row.save(); + } else { + const row = await Guild.findByPk(guild.id); + row.prefix = this.client.config.prefix; + await row.save(); + } + } + + async exec(message: Message, { prefix }: { prefix?: string }): Promise { + await this.changePrefix(message.guild, prefix); + if (prefix) { + await message.util.send(`Sucessfully set prefix to \`${prefix}\``); + } else { + await message.util.send( + `Sucessfully reset prefix to \`${this.client.config.prefix}\`` + ); + } + } + + async execSlash( + message: CommandInteraction, + { prefix }: { prefix?: SlashCommandOption } + ): Promise { + await this.changePrefix(message.guild, prefix?.value); + if (prefix) { + await message.reply(`Sucessfully set prefix to \`${prefix.value}\``); + } else { + await message.reply( + `Sucessfully reset prefix to \`${this.client.config.prefix}\`` + ); + } + } +} diff --git a/src/commands/server-config/prefixCommand.ts b/src/commands/server-config/prefixCommand.ts deleted file mode 100644 index cf70bd2..0000000 --- a/src/commands/server-config/prefixCommand.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; -import { CommandInteraction, Message, Guild as DiscordGuild } from 'discord.js'; -import { BushCommand } from '../../lib/extensions/BushCommand'; -import { SlashCommandOption } from '../../lib/extensions/Util'; -import { Guild } from '../../lib/models'; - -export default class PrefixCommand extends BushCommand { - constructor() { - super('prefix', { - aliases: ['prefix'], - category: 'server config', - args: [ - { - id: 'prefix' - } - ], - userPermissions: ['MANAGE_GUILD'], - description: { - content: - 'Set the prefix of the current server (resets to default if prefix is not given)', - usage: 'prefix [prefix]', - examples: ['prefix', 'prefix +'] - }, - slashCommandOptions: [ - { - type: ApplicationCommandOptionType.STRING, - name: 'prefix', - description: 'The prefix to set for this server', - required: false - } - ] - }); - } - - async changePrefix(guild: DiscordGuild, prefix?: string): Promise { - if (prefix) { - const row = await Guild.findByPk(guild.id); - row.prefix = prefix; - await row.save(); - } else { - const row = await Guild.findByPk(guild.id); - row.prefix = this.client.config.prefix; - await row.save(); - } - } - - async exec(message: Message, { prefix }: { prefix?: string }): Promise { - await this.changePrefix(message.guild, prefix); - if (prefix) { - await message.util.send(`Sucessfully set prefix to \`${prefix}\``); - } else { - await message.util.send( - `Sucessfully reset prefix to \`${this.client.config.prefix}\`` - ); - } - } - - async execSlash( - message: CommandInteraction, - { prefix }: { prefix?: SlashCommandOption } - ): Promise { - await this.changePrefix(message.guild, prefix?.value); - if (prefix) { - await message.reply(`Sucessfully set prefix to \`${prefix.value}\``); - } else { - await message.reply( - `Sucessfully reset prefix to \`${this.client.config.prefix}\`` - ); - } - } -} -- cgit