Get lobby command to use IDs instead of names
This commit is contained in:
parent
aeba45c076
commit
d4673af357
3 changed files with 12 additions and 12 deletions
|
@ -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 ]===
|
===[ EXAMPLE ]===
|
||||||
To add a channel:
|
To add a channel:
|
||||||
- config add game-name role-name 30 Game Name
|
- config add 000000000000000000 000000000000000000 30 Game Name
|
||||||
|
|
||||||
To remove a channel:
|
To remove a channel:
|
||||||
- config remove game-name
|
- config remove 000000000000000000
|
|
@ -106,8 +106,8 @@ export default class Lobby extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async AddLobbyConfig(context: ICommandContext) {
|
private async AddLobbyConfig(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]);
|
||||||
const role = context.message.guild!.roles.cache.find(x => x.name == context.args[3]);
|
const role = context.message.guild!.roles.cache.find(x => x.id == context.args[3]);
|
||||||
const cooldown = Number(context.args[4]) || 30;
|
const cooldown = Number(context.args[4]) || 30;
|
||||||
const gameName = context.args.splice(5).join(" ");
|
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);
|
const entity = new eLobby(channel.id, role.id, cooldown, gameName);
|
||||||
await entity.Save(eLobby, entity);
|
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();
|
embed.SendToCurrentChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async RemoveLobbyConfig(context: ICommandContext) {
|
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) {
|
if (!channel) {
|
||||||
this.SendConfigHelp(context);
|
this.SendConfigHelp(context);
|
||||||
|
@ -137,7 +137,7 @@ export default class Lobby extends Command {
|
||||||
await BaseEntity.Remove<eLobby>(eLobby, entity);
|
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();
|
embed.SendToCurrentChannel();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -103,7 +103,7 @@ export default class Role extends Command {
|
||||||
public async AddRole(context: ICommandContext, role: DiscordRole): Promise<ICommandReturnContext> {
|
public async AddRole(context: ICommandContext, role: DiscordRole): Promise<ICommandReturnContext> {
|
||||||
await context.message.member?.roles.add(role, "Toggled with role command");
|
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();
|
embed.SendToCurrentChannel();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -115,7 +115,7 @@ export default class Role extends Command {
|
||||||
public async RemoveRole(context: ICommandContext, role: DiscordRole): Promise<ICommandReturnContext> {
|
public async RemoveRole(context: ICommandContext, role: DiscordRole): Promise<ICommandReturnContext> {
|
||||||
await context.message.member?.roles.remove(role, "Toggled with role command");
|
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();
|
embed.SendToCurrentChannel();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -175,7 +175,7 @@ export default class Role extends Command {
|
||||||
|
|
||||||
await SettingsHelper.SetSetting("role.assignable", context.message.guild!.id, setting);
|
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();
|
embed.SendToCurrentChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ export default class Role extends Command {
|
||||||
|
|
||||||
await SettingsHelper.SetSetting("role.assignable", context.message.guild!.id, setting);
|
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();
|
embed.SendToCurrentChannel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue