From 0caccda67d97dd74405aa4ece5d3f07e7c7dfc66 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Wed, 26 May 2021 21:36:50 -0400 Subject: some rebranding --- src/commands/server-config/prefix.ts | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/commands/server-config/prefix.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..ac85922 --- /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}\`` + ); + } + } +} -- cgit From cd0f853a2e4732cea5356f9ee3603bb804b0ab1f Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Wed, 26 May 2021 21:53:35 -0400 Subject: made some more changes --- src/commands/server-config/prefix.ts | 71 ----------------------------- src/commands/server-config/prefixCommand.ts | 71 +++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 71 deletions(-) delete mode 100644 src/commands/server-config/prefix.ts create 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 deleted file mode 100644 index ac85922..0000000 --- a/src/commands/server-config/prefix.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}\`` - ); - } - } -} diff --git a/src/commands/server-config/prefixCommand.ts b/src/commands/server-config/prefixCommand.ts new file mode 100644 index 0000000..ac85922 --- /dev/null +++ b/src/commands/server-config/prefixCommand.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}\`` + ); + } + } +} -- cgit From 2dc71f5876965fe3d0598a0f4addec737e00f1ae Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Wed, 26 May 2021 21:54:12 -0400 Subject: format --- src/commands/server-config/prefixCommand.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/commands/server-config') diff --git a/src/commands/server-config/prefixCommand.ts b/src/commands/server-config/prefixCommand.ts index ac85922..cf70bd2 100644 --- a/src/commands/server-config/prefixCommand.ts +++ b/src/commands/server-config/prefixCommand.ts @@ -8,7 +8,7 @@ export default class PrefixCommand extends BushCommand { constructor() { super('prefix', { aliases: ['prefix'], - category: "server config", + category: 'server config', args: [ { id: 'prefix' -- cgit 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 From 795a773462df83969783496f29fed969a53c66ab Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Thu, 27 May 2021 15:31:50 -0600 Subject: fix probably idk --- src/commands/server-config/prefix.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/commands/server-config') diff --git a/src/commands/server-config/prefix.ts b/src/commands/server-config/prefix.ts index cf70bd2..661284f 100644 --- a/src/commands/server-config/prefix.ts +++ b/src/commands/server-config/prefix.ts @@ -33,8 +33,13 @@ export default class PrefixCommand extends BushCommand { } async changePrefix(guild: DiscordGuild, prefix?: string): Promise { + let row = await Guild.findByPk(guild.id); + if (!row) { + row = Guild.build({ + id: guild.id + }) + } if (prefix) { - const row = await Guild.findByPk(guild.id); row.prefix = prefix; await row.save(); } else { -- cgit From 3fe86257c65a067221675737559a2c0aaa5b9806 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 27 May 2021 21:32:17 +0000 Subject: Automatically format code --- src/commands/server-config/prefix.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/commands/server-config') diff --git a/src/commands/server-config/prefix.ts b/src/commands/server-config/prefix.ts index 661284f..899ecc9 100644 --- a/src/commands/server-config/prefix.ts +++ b/src/commands/server-config/prefix.ts @@ -37,7 +37,7 @@ export default class PrefixCommand extends BushCommand { if (!row) { row = Guild.build({ id: guild.id - }) + }); } if (prefix) { row.prefix = prefix; -- cgit From f1cdbd260c6c2249fc0d765949d44d889bcaedc8 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Fri, 28 May 2021 17:37:04 -0400 Subject: I can't read anything --- src/commands/server-config/prefix.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/commands/server-config') diff --git a/src/commands/server-config/prefix.ts b/src/commands/server-config/prefix.ts index 899ecc9..f02e693 100644 --- a/src/commands/server-config/prefix.ts +++ b/src/commands/server-config/prefix.ts @@ -16,8 +16,7 @@ export default class PrefixCommand extends BushCommand { ], userPermissions: ['MANAGE_GUILD'], description: { - content: - 'Set the prefix of the current server (resets to default if prefix is not given)', + content: 'Set the prefix of the current server (resets to default if prefix is not given)', usage: 'prefix [prefix]', examples: ['prefix', 'prefix +'] }, @@ -54,9 +53,7 @@ export default class PrefixCommand extends BushCommand { if (prefix) { await message.util.send(`Sucessfully set prefix to \`${prefix}\``); } else { - await message.util.send( - `Sucessfully reset prefix to \`${this.client.config.prefix}\`` - ); + await message.util.send(`Sucessfully reset prefix to \`${this.client.config.prefix}\``); } } @@ -68,9 +65,7 @@ export default class PrefixCommand extends BushCommand { if (prefix) { await message.reply(`Sucessfully set prefix to \`${prefix.value}\``); } else { - await message.reply( - `Sucessfully reset prefix to \`${this.client.config.prefix}\`` - ); + await message.reply(`Sucessfully reset prefix to \`${this.client.config.prefix}\``); } } } -- cgit From 25cf269e2e793de5fefb9aa3f19fb167168e06c6 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Fri, 28 May 2021 20:13:49 -0400 Subject: stuff --- src/commands/server-config/prefix.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/commands/server-config') diff --git a/src/commands/server-config/prefix.ts b/src/commands/server-config/prefix.ts index f02e693..c60f8fb 100644 --- a/src/commands/server-config/prefix.ts +++ b/src/commands/server-config/prefix.ts @@ -57,10 +57,7 @@ export default class PrefixCommand extends BushCommand { } } - async execSlash( - message: CommandInteraction, - { prefix }: { prefix?: SlashCommandOption } - ): Promise { + 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}\``); -- cgit