updated lang strings

This commit is contained in:
2022-02-13 19:23:28 -06:00
parent f225bf924a
commit 17643dc730
6 changed files with 40 additions and 24 deletions

View File

@@ -8,13 +8,20 @@ const LANG: LangObjWhold = {
create: 'A queue for teams of {teamsize} has been created',
close: 'Queue has been closed',
join: 'Joined the queue',
leave: 'Left the queue',
error: {
leave: 'Left the queue'
},
error: {
discord: {
noQueue: 'There is not an active queue in this channel, type `/open` to create one',
noChannel: 'Unable to find channel {channelId} for teams of {teamsize}',
noCreate: 'There is already an active queue in this channel for teams of ${teamsize}',
inQueue: 'You are already in the queue',
notInQueue: 'You aren\'t in the queue'
notInQueue: 'You aren\'t in the queue',
notMod: 'Member is not a moderator'
},
general: {
noMember: 'Unable to retrieve guild member information, please try again',
noChannel: 'Unable to retrieve text channel information, please try again'
}
}
}

View File

@@ -104,7 +104,7 @@ export async function discordInit(client: Client) {
}
if (!channel || !(channel instanceof TextChannel)) {
console.error(Lang.get('discord.error.noChannel'), {
console.error(Lang.get('error.discord.noChannel'), {
channelId,
teamsize: info.teamsize
});
@@ -129,7 +129,7 @@ export namespace QueueCommands {
let info = QUEUE.get(interaction.channelId);
if (!info)
throw emsg(Lang.get('discord.error.noQueue'));
throw emsg('discord.noQueue');
return info;
}
@@ -174,7 +174,7 @@ export namespace QueueCommands {
teamsize = interaction.options.getInteger('teamsize', true);
if (QUEUE.has(channelId))
throw emsg(Lang.get('discord.error.noCreate', {
throw emsg(Lang.get('error.discord.noCreate', {
teamsize: QUEUE.get(channelId)?.teamsize
}));
@@ -240,7 +240,7 @@ export namespace QueueCommands {
let {member, info, channel} = getAll(interaction);
if (queueContains(interaction))
throw emsg(Lang.get('discord.error.inQueue'));
throw emsg('discord.inQueue');
info.players.push(member);
@@ -262,7 +262,7 @@ export namespace QueueCommands {
let {member, info} = getAll(interaction);
if (!queueContains(interaction))
throw emsg(Lang.get('discord.error.notInQueue'));
throw emsg('discord.notInQueue');
info.players.splice(info.players.indexOf(member), 1);

View File

@@ -1,4 +1,5 @@
import { CommandInteraction, GuildMember, TextChannel } from "discord.js";
import { Lang } from "./lang";
/**
* shuffles an array
@@ -42,7 +43,7 @@ export class errorMessage {
* @param ephemeral (default=true)
* @returns new errorMessage
*/
export const emsg = (msg: string, ephemeral: boolean = true) => new errorMessage(msg, ephemeral);
export const emsg = (msg: string, ephemeral: boolean = true) => new errorMessage(Lang.get(`error.${msg}`), ephemeral);
@@ -63,7 +64,7 @@ export function getMember(interaction: CommandInteraction): GuildMember {
let member = interaction.member;
if (!(member instanceof GuildMember))
throw emsg('Unable to retrieve guild member information, please try again');
throw emsg('general.noMember');
return member;
}
@@ -78,7 +79,7 @@ export function getChannel(interaction: CommandInteraction): TextChannel {
let channel = interaction.channel;
if (!(channel instanceof TextChannel))
throw emsg('Unable to retrieve text channel information, please try again');
throw emsg('general.noChannel');
return channel;
}
@@ -91,5 +92,5 @@ export function memberIsMod(interaction: CommandInteraction): boolean {
export function memberIsModThrow(interaction: CommandInteraction) {
if (!memberIsMod(interaction))
throw emsg('Member is not a moderator');
throw emsg('discord.notMod');
}