v3.0.2 (#159)
* Change lobby command to error upon making a duplicate lobby channel (#154) * Update lobby command to give proper errors if role or channel id cannot be found (#156) * Add bunny command back (#157) * 150 assignable roles should be its own table to prevent limitations on length (#158) * Add entity * Update role config command to use new entity * Update role command to use new entity * Remove legacy code from config command * Update .env template to current date
This commit is contained in:
parent
31866b1c3b
commit
aa070bb7a7
10 changed files with 188 additions and 52 deletions
|
@ -111,8 +111,26 @@ export default class Lobby extends Command {
|
|||
const cooldown = Number(context.args[4]) || 30;
|
||||
const gameName = context.args.splice(5).join(" ");
|
||||
|
||||
if (!channel || !role) {
|
||||
this.SendConfigHelp(context);
|
||||
if (!channel) {
|
||||
const errorEmbed = new ErrorEmbed(context, "The channel id you provided is invalid or channel does not exist.");
|
||||
errorEmbed.SendToCurrentChannel();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!role) {
|
||||
const errorEmbed = new ErrorEmbed(context, "The role id you provided is invalid or role does not exist.");
|
||||
errorEmbed.SendToCurrentChannel();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const lobby = await eLobby.FetchOneByChannelId(channel.id);
|
||||
|
||||
if (lobby) {
|
||||
const errorEmbed = new ErrorEmbed(context, "This channel has already been setup.");
|
||||
errorEmbed.SendToCurrentChannel();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -124,20 +142,18 @@ export default class Lobby extends Command {
|
|||
}
|
||||
|
||||
private async RemoveLobbyConfig(context: ICommandContext) {
|
||||
const channel = context.message.guild!.channels.cache.find(x => x.id == context.args[2]);
|
||||
const entity = await eLobby.FetchOneByChannelId(context.args[2]);
|
||||
|
||||
if (!entity) {
|
||||
const errorEmbed = new ErrorEmbed(context, "The channel id you provided has not been setup as a lobby, unable to remove.");
|
||||
errorEmbed.SendToCurrentChannel();
|
||||
|
||||
if (!channel) {
|
||||
this.SendConfigHelp(context);
|
||||
return;
|
||||
}
|
||||
|
||||
await BaseEntity.Remove<eLobby>(eLobby, entity);
|
||||
|
||||
const entity = await eLobby.FetchOneByChannelId(channel.id);
|
||||
|
||||
if (entity) {
|
||||
await BaseEntity.Remove<eLobby>(eLobby, entity);
|
||||
}
|
||||
|
||||
const embed = new PublicEmbed(context, "", `Removed \`${channel.name}\` from the list of lobby channels`);
|
||||
const embed = new PublicEmbed(context, "", `Removed <#${context.args[2]}> from the list of lobby channels`);
|
||||
embed.SendToCurrentChannel();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue