From 09c431def7ec29f639a6b3f9461f924f88edb4f7 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sat, 17 Sep 2022 16:32:12 +0100 Subject: [PATCH] Fix guild-specific commands not showing up --- src/client/client.ts | 2 +- src/commands/501231711271780357/Lobby/add.ts | 14 +++++++++----- src/commands/501231711271780357/Lobby/lobby.ts | 2 +- src/commands/501231711271780357/Lobby/remove.ts | 5 +++-- src/commands/Role/role.ts | 3 +-- src/commands/audits.ts | 3 ++- src/commands/clear.ts | 1 + src/commands/config.ts | 12 ++++++++---- 8 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/client/client.ts b/src/client/client.ts index 4031f24..4b933f3 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -49,7 +49,7 @@ export class CoreClient extends Client { super.on("interactionCreate", this._events.onInteractionCreate); super.on("ready", this._events.onReady); - super.login(process.env.BOT_TOKEN); + await super.login(process.env.BOT_TOKEN); this._util.loadEvents(this, CoreClient._eventItems); this._util.loadSlashCommands(this); diff --git a/src/commands/501231711271780357/Lobby/add.ts b/src/commands/501231711271780357/Lobby/add.ts index 105844c..16a38d2 100644 --- a/src/commands/501231711271780357/Lobby/add.ts +++ b/src/commands/501231711271780357/Lobby/add.ts @@ -13,19 +13,23 @@ export default class AddRole extends Command { .addChannelOption(option => option .setName('channel') - .setDescription('The channel')) + .setDescription('The channel') + .setRequired(true)) .addRoleOption(option => option .setName('role') - .setDescription('The role to ping on request')) + .setDescription('The role to ping on request') + .setRequired(true)) .addNumberOption(option => option .setName('cooldown') - .setDescription('The cooldown in minutes')) + .setDescription('The cooldown in minutes') + .setRequired(true)) .addStringOption(option => option .setName('name') - .setDescription('The game name')); + .setDescription('The game name') + .setRequired(true)); } public override async execute(interaction: CommandInteraction) { @@ -49,6 +53,6 @@ export default class AddRole extends Command { const entity = new eLobby(channel.channel.id, role.role.id, cooldown.value as number, gameName.value as string); await entity.Save(eLobby, entity); - await interaction.reply(`Added \`${channel.name}\` as a new lobby channel with a cooldown of \`${cooldown} minutes \` and will ping \`${role.name}\` on use`); + await interaction.reply(`Added \`${channel.name}\` as a new lobby channel with a cooldown of \`${cooldown.value} minutes \` and will ping \`${role.name}\` on use`); } } \ No newline at end of file diff --git a/src/commands/501231711271780357/Lobby/lobby.ts b/src/commands/501231711271780357/Lobby/lobby.ts index 5be32ad..d7f0d42 100644 --- a/src/commands/501231711271780357/Lobby/lobby.ts +++ b/src/commands/501231711271780357/Lobby/lobby.ts @@ -36,6 +36,6 @@ export default class Lobby extends Command { lobby.MarkAsUsed(); await lobby.Save(eLobby, lobby); - await interaction.reply(`${interaction.user} would like to organise a lobby of **${lobby.Name}**! <@${lobby.RoleId}>`); + await interaction.reply(`${interaction.user} would like to organise a lobby of **${lobby.Name}**! <@&${lobby.RoleId}>`); } } \ No newline at end of file diff --git a/src/commands/501231711271780357/Lobby/remove.ts b/src/commands/501231711271780357/Lobby/remove.ts index 9dac70b..b350316 100644 --- a/src/commands/501231711271780357/Lobby/remove.ts +++ b/src/commands/501231711271780357/Lobby/remove.ts @@ -14,7 +14,8 @@ export default class RemoveLobby extends Command { .addChannelOption(option => option .setName('channel') - .setDescription('The channel')); + .setDescription('The channel') + .setRequired(true)); } public override async execute(interaction: CommandInteraction) { @@ -34,6 +35,6 @@ export default class RemoveLobby extends Command { await BaseEntity.Remove(eLobby, entity); - await interaction.reply(`Removed <#${channel.channel.name}> from the list of lobby channels`); + await interaction.reply(`Removed <#${channel.channel.id}> from the list of lobby channels`); } } \ No newline at end of file diff --git a/src/commands/Role/role.ts b/src/commands/Role/role.ts index 6e57653..85b0abf 100644 --- a/src/commands/Role/role.ts +++ b/src/commands/Role/role.ts @@ -1,4 +1,4 @@ -import { CommandInteraction, EmbedBuilder, GuildMember, GuildMemberRoleManager, SlashCommandBuilder } from "discord.js"; +import { CommandInteraction, EmbedBuilder, GuildMemberRoleManager, SlashCommandBuilder } from "discord.js"; import { Command } from "../../type/command"; import { default as eRole } from "../../entity/Role"; import EmbedColours from "../../constants/EmbedColours"; @@ -69,7 +69,6 @@ export default class Role extends Command { } const roleManager = interaction.member.roles as GuildMemberRoleManager; - const member = interaction.member as GuildMember; const userRole = roleManager.cache.find(x => x.name == requestedRole.role!.name); const assignRole = interaction.guild.roles.cache.find(x => x.id == requestedRole.role!.id); diff --git a/src/commands/audits.ts b/src/commands/audits.ts index 8c87397..3dabe26 100644 --- a/src/commands/audits.ts +++ b/src/commands/audits.ts @@ -60,7 +60,8 @@ export default class Audits extends Command { { name: 'Mute', value: AuditType.Mute.toString() }, { name: 'Kick', value: AuditType.Kick.toString() }, { name: 'Ban', value: AuditType.Ban.toString() }, - )) + ) + .setRequired(true)) .addStringOption(option => option .setName('reason') diff --git a/src/commands/clear.ts b/src/commands/clear.ts index 981c847..a448a7b 100644 --- a/src/commands/clear.ts +++ b/src/commands/clear.ts @@ -13,6 +13,7 @@ export default class Clear extends Command { option .setName('count') .setDescription('The amount to delete') + .setRequired(true) .setMinValue(1) .setMaxValue(100)); } diff --git a/src/commands/config.ts b/src/commands/config.ts index b4887ea..a370f27 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -21,7 +21,8 @@ export default class Config extends Command { .addStringOption(option => option .setName('key') - .setDescription('The key'))) + .setDescription('The key') + .setRequired(true))) .addSubcommand(subcommand => subcommand .setName('get') @@ -29,7 +30,8 @@ export default class Config extends Command { .addStringOption(option => option .setName('key') - .setDescription('The key'))) + .setDescription('The key') + .setRequired(true))) .addSubcommand(subcommand => subcommand .setName('set') @@ -37,11 +39,13 @@ export default class Config extends Command { .addStringOption(option => option .setName('key') - .setDescription('The key')) + .setDescription('The key') + .setRequired(true)) .addStringOption(option => option .setName('value') - .setDescription('The value'))) + .setDescription('The value') + .setRequired(true))) .addSubcommand(subcommand => subcommand .setName('list')