From 373f1d3d33dab01e42a4f4c5580691e7f27688aa Mon Sep 17 00:00:00 2001 From: Vylpes Date: Sat, 23 Apr 2022 19:03:13 +0100 Subject: [PATCH] Get lobby command to use IDs instead of names (#144) --- data/usage/lobby.txt | 6 +++--- src/commands/501231711271780357/lobby.ts | 10 +++++----- src/commands/role.ts | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data/usage/lobby.txt b/data/usage/lobby.txt index ed65f72..6fe4a3b 100644 --- a/data/usage/lobby.txt +++ b/data/usage/lobby.txt @@ -1,8 +1,8 @@ -USAGE: config [cooldown] [Game Name] +USAGE: config [cooldown] [Game Name] ===[ EXAMPLE ]=== To add a channel: -- config add game-name role-name 30 Game Name +- config add 000000000000000000 000000000000000000 30 Game Name To remove a channel: -- config remove game-name \ No newline at end of file +- config remove 000000000000000000 \ No newline at end of file diff --git a/src/commands/501231711271780357/lobby.ts b/src/commands/501231711271780357/lobby.ts index c4b4bea..6d3a58c 100644 --- a/src/commands/501231711271780357/lobby.ts +++ b/src/commands/501231711271780357/lobby.ts @@ -106,8 +106,8 @@ export default class Lobby extends Command { } private async AddLobbyConfig(context: ICommandContext) { - const channel = context.message.guild!.channels.cache.find(x => x.name == context.args[2]); - const role = context.message.guild!.roles.cache.find(x => x.name == context.args[3]); + const channel = context.message.guild!.channels.cache.find(x => x.id == context.args[2]); + const role = context.message.guild!.roles.cache.find(x => x.id == context.args[3]); const cooldown = Number(context.args[4]) || 30; const gameName = context.args.splice(5).join(" "); @@ -119,12 +119,12 @@ export default class Lobby extends Command { const entity = new eLobby(channel.id, role.id, cooldown, gameName); await entity.Save(eLobby, entity); - const embed = new PublicEmbed(context, "", "Added new lobby channel"); + const embed = new PublicEmbed(context, "", `Added \`${channel.name}\` as a new lobby channel with a cooldown of \`${cooldown} minutes\` and will ping \`${role.name}\` on use`); embed.SendToCurrentChannel(); } private async RemoveLobbyConfig(context: ICommandContext) { - const channel = context.message.guild!.channels.cache.find(x => x.name == context.args[2]); + const channel = context.message.guild!.channels.cache.find(x => x.id == context.args[2]); if (!channel) { this.SendConfigHelp(context); @@ -137,7 +137,7 @@ export default class Lobby extends Command { await BaseEntity.Remove(eLobby, entity); } - const embed = new PublicEmbed(context, "", "Removed lobby channel"); + const embed = new PublicEmbed(context, "", `Removed \`${channel.name}\` from the list of lobby channels`); embed.SendToCurrentChannel(); } } \ No newline at end of file diff --git a/src/commands/role.ts b/src/commands/role.ts index 6db403b..9a0af00 100644 --- a/src/commands/role.ts +++ b/src/commands/role.ts @@ -103,7 +103,7 @@ export default class Role extends Command { public async AddRole(context: ICommandContext, role: DiscordRole): Promise { await context.message.member?.roles.add(role, "Toggled with role command"); - const embed = new PublicEmbed(context, "", `Gave role: ${role.name}`); + const embed = new PublicEmbed(context, "", `Gave role: \`${role.name}\``); embed.SendToCurrentChannel(); return { @@ -115,7 +115,7 @@ export default class Role extends Command { public async RemoveRole(context: ICommandContext, role: DiscordRole): Promise { await context.message.member?.roles.remove(role, "Toggled with role command"); - const embed = new PublicEmbed(context, "", `Removed role: ${role.name}`); + const embed = new PublicEmbed(context, "", `Removed role: \`${role.name}\``); embed.SendToCurrentChannel(); return { @@ -175,7 +175,7 @@ export default class Role extends Command { await SettingsHelper.SetSetting("role.assignable", context.message.guild!.id, setting); - const embed = new PublicEmbed(context, "", "Added new assignable role"); + const embed = new PublicEmbed(context, "", `Added \`${role.name}\` as a new assignable role`); embed.SendToCurrentChannel(); } @@ -203,7 +203,7 @@ export default class Role extends Command { await SettingsHelper.SetSetting("role.assignable", context.message.guild!.id, setting); - const embed = new PublicEmbed(context, "", "Removed assignable role"); + const embed = new PublicEmbed(context, "", `Removed \`${role.name}\` from the list of assignable roles`); embed.SendToCurrentChannel(); } }