aboutsummaryrefslogtreecommitdiff
path: root/src/commands/config/features.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-19 18:52:41 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-19 18:52:41 -0500
commite78beed6c7e094ef48aad5d18da01b2bbed4536c (patch)
tree32676793af5f7bdc39d438ff284fa5b959274e96 /src/commands/config/features.ts
parenta3103b629250de3fb97a40a4f9ff7e7ba28f4d16 (diff)
downloadtanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.tar.gz
tanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.tar.bz2
tanzanite-e78beed6c7e094ef48aad5d18da01b2bbed4536c.zip
fix: a ton of shit
Diffstat (limited to 'src/commands/config/features.ts')
-rw-r--r--src/commands/config/features.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index 199f201..c9aebd3 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -6,6 +6,7 @@ import {
type BushSlashMessage,
type GuildFeatures
} from '#lib';
+import assert from 'assert';
import {
ActionRow,
ComponentType,
@@ -33,11 +34,11 @@ export default class FeaturesCommand extends BushCommand {
}
public override async exec(message: BushMessage | BushSlashMessage) {
- if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
+ assert(message.inGuild());
- const featureEmbed = new Embed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default);
+ const featureEmbed = new Embed().setTitle(`${message.guild.name}'s Features`).setColor(util.colors.default);
- const enabledFeatures = await message.guild!.getSetting('enabledFeatures');
+ const enabledFeatures = await message.guild.getSetting('enabledFeatures');
this.generateDescription(guildFeaturesArr, enabledFeatures, featureEmbed);
const components = this.generateComponents(guildFeaturesArr, false);
const msg = (await message.util.reply({ embeds: [featureEmbed], components: [components] })) as Message;
@@ -49,7 +50,7 @@ export default class FeaturesCommand extends BushCommand {
collector.on('collect', async (interaction: SelectMenuInteraction) => {
if (interaction.user.id === message.author.id || client.config.owners.includes(interaction.user.id)) {
- if (!message.guild) throw new Error('message.guild is null');
+ assert(message.inGuild());
const [selected]: GuildFeatures[] = interaction.values as GuildFeatures[];