aboutsummaryrefslogtreecommitdiff
path: root/src/commands/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/config')
-rw-r--r--src/commands/config/config.ts31
-rw-r--r--src/commands/config/features.ts17
2 files changed, 26 insertions, 22 deletions
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index a90a267..c1dd142 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -12,19 +12,19 @@ import {
import assert from 'assert';
import { type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo';
import {
- ActionRow,
+ ActionRowBuilder,
ApplicationCommandOptionType,
- ButtonComponent,
+ ButtonBuilder,
ButtonStyle,
Channel,
- Embed,
+ EmbedBuilder,
Formatters,
GuildMember,
InteractionUpdateOptions,
PermissionFlagsBits,
Role,
- SelectMenuComponent,
- SelectMenuOption,
+ SelectMenuBuilder,
+ UnsafeSelectMenuOptionBuilder,
User,
type Message,
type MessageComponentInteraction,
@@ -285,18 +285,21 @@ export default class ConfigCommand extends BushCommand {
case 'command_settingsSel': {
if (!interaction.isSelectMenu()) return;
- return interaction.update(
+ await interaction.update(
await this.generateMessageOptions(message, interaction.values[0] as keyof typeof guildSettingsObj)
);
+ return;
}
case 'command_settingsBack': {
if (!interaction.isButton()) return;
- return interaction.update(await this.generateMessageOptions(message));
+ await interaction.update(await this.generateMessageOptions(message));
+ return;
}
}
} else {
- return await interaction?.deferUpdate().catch(() => undefined);
+ await interaction?.deferUpdate().catch(() => undefined);
+ return;
}
});
}
@@ -307,17 +310,17 @@ export default class ConfigCommand extends BushCommand {
): Promise<MessageOptions & InteractionUpdateOptions> {
assert(message.inGuild());
- const settingsEmbed = new Embed().setColor(util.colors.default);
+ const settingsEmbed = new EmbedBuilder().setColor(util.colors.default);
if (!setting) {
settingsEmbed.setTitle(`${message.guild.name}'s Settings`);
const desc = settingsArr.map((s) => `:wrench: **${guildSettingsObj[s].name}**`).join('\n');
settingsEmbed.setDescription(desc);
- const selMenu = new ActionRow().addComponents(
- new SelectMenuComponent()
+ const selMenu = new ActionRowBuilder<SelectMenuBuilder>().addComponents(
+ new SelectMenuBuilder()
.addOptions(
...settingsArr.map((s) =>
- new SelectMenuOption()
+ new UnsafeSelectMenuOptionBuilder()
.setLabel(guildSettingsObj[s].name)
.setValue(s)
.setDescription(guildSettingsObj[s].description)
@@ -360,8 +363,8 @@ export default class ConfigCommand extends BushCommand {
: '[No Value Set]';
};
- const components = new ActionRow().addComponents(
- new ButtonComponent({ style: ButtonStyle.Primary, customId: 'command_settingsBack', label: 'Back' })
+ const components = new ActionRowBuilder<ButtonBuilder>().addComponents(
+ new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'command_settingsBack', label: 'Back' })
);
settingsEmbed.setDescription(
`${Formatters.italic(guildSettingsObj[setting].description)}\n\n**Type:** ${guildSettingsObj[setting].type}`
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index c022a3a..5218bcf 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -8,11 +8,11 @@ import {
} from '#lib';
import assert from 'assert';
import {
- ActionRow,
+ ActionRowBuilder,
ComponentType,
- Embed,
+ EmbedBuilder,
PermissionFlagsBits,
- SelectMenuComponent,
+ SelectMenuBuilder,
type Message,
type SelectMenuInteraction
} from 'discord.js';
@@ -35,7 +35,7 @@ export default class FeaturesCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage) {
assert(message.inGuild());
- const featureEmbed = new Embed().setTitle(`${message.guild.name}'s Features`).setColor(util.colors.default);
+ const featureEmbed = new EmbedBuilder().setTitle(`${message.guild.name}'s Features`).setColor(util.colors.default);
const enabledFeatures = await message.guild.getSetting('enabledFeatures');
this.generateDescription(guildFeaturesArr, enabledFeatures, featureEmbed);
@@ -62,7 +62,8 @@ export default class FeaturesCommand extends BushCommand {
await interaction.update({ embeds: [featureEmbed] }).catch(() => undefined);
return;
} else {
- return await interaction?.deferUpdate().catch(() => undefined);
+ await interaction?.deferUpdate().catch(() => undefined);
+ return;
}
});
@@ -71,7 +72,7 @@ export default class FeaturesCommand extends BushCommand {
});
}
- public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: Embed): void {
+ public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: EmbedBuilder): void {
embed.setDescription(
allFeatures
.map(
@@ -83,8 +84,8 @@ export default class FeaturesCommand extends BushCommand {
}
public generateComponents(guildFeatures: GuildFeatures[], disable: boolean) {
- return new ActionRow().addComponents(
- new SelectMenuComponent({
+ return new ActionRowBuilder<SelectMenuBuilder>().addComponents(
+ new SelectMenuBuilder({
customId: 'command_selectFeature',
disabled: disable,
maxValues: 1,