Get lobby command to use IDs instead of names (#144)

This commit is contained in:
Vylpes 2022-04-23 19:03:13 +01:00 committed by GitHub
parent aeba45c076
commit 373f1d3d33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View file

@ -1,8 +1,8 @@
USAGE: config <add|remove> <Channel Name> <Role Name> [cooldown] [Game Name]
USAGE: config <add|remove> <Channel ID> <Role ID> [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
- config remove 000000000000000000

View file

@ -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>(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();
}
}

View file

@ -103,7 +103,7 @@ export default class Role extends Command {
public async AddRole(context: ICommandContext, role: DiscordRole): Promise<ICommandReturnContext> {
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<ICommandReturnContext> {
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();
}
}