updated lang strings
This commit is contained in:
13
dist/lang.js
vendored
13
dist/lang.js
vendored
@@ -8,13 +8,20 @@ const LANG = {
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
dist/queue.js
vendored
10
dist/queue.js
vendored
@@ -98,7 +98,7 @@ async function discordInit(client) {
|
||||
continue;
|
||||
}
|
||||
if (!channel || !(channel instanceof discord_js_1.TextChannel)) {
|
||||
console.error(lang_1.Lang.get('discord.error.noChannel'), {
|
||||
console.error(lang_1.Lang.get('error.discord.noChannel'), {
|
||||
channelId,
|
||||
teamsize: info.teamsize
|
||||
});
|
||||
@@ -120,7 +120,7 @@ var QueueCommands;
|
||||
function getInfo(interaction) {
|
||||
let info = QUEUE.get(interaction.channelId);
|
||||
if (!info)
|
||||
throw (0, util_1.emsg)(lang_1.Lang.get('discord.error.noQueue'));
|
||||
throw (0, util_1.emsg)('discord.noQueue');
|
||||
return info;
|
||||
}
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ var QueueCommands;
|
||||
(0, util_1.memberIsModThrow)(interaction);
|
||||
let { channelId } = interaction, teamsize = interaction.options.getInteger('teamsize', true);
|
||||
if (QUEUE.has(channelId))
|
||||
throw (0, util_1.emsg)(lang_1.Lang.get('discord.error.noCreate', {
|
||||
throw (0, util_1.emsg)(lang_1.Lang.get('error.discord.noCreate', {
|
||||
teamsize: QUEUE.get(channelId)?.teamsize
|
||||
}));
|
||||
Queue.create(channelId, teamsize);
|
||||
@@ -207,7 +207,7 @@ var QueueCommands;
|
||||
async function join(interaction) {
|
||||
let { member, info, channel } = getAll(interaction);
|
||||
if (queueContains(interaction))
|
||||
throw (0, util_1.emsg)(lang_1.Lang.get('discord.error.inQueue'));
|
||||
throw (0, util_1.emsg)('discord.inQueue');
|
||||
info.players.push(member);
|
||||
QUEUE.set(interaction.channelId, info);
|
||||
await interaction.reply(lang_1.Lang.get('discord.join'));
|
||||
@@ -222,7 +222,7 @@ var QueueCommands;
|
||||
async function leave(interaction) {
|
||||
let { member, info } = getAll(interaction);
|
||||
if (!queueContains(interaction))
|
||||
throw (0, util_1.emsg)(lang_1.Lang.get('discord.error.notInQueue'));
|
||||
throw (0, util_1.emsg)('discord.notInQueue');
|
||||
info.players.splice(info.players.indexOf(member), 1);
|
||||
QUEUE.set(interaction.channelId, info);
|
||||
await interaction.reply(lang_1.Lang.get('discord.leave'));
|
||||
|
||||
9
dist/util.js
vendored
9
dist/util.js
vendored
@@ -2,6 +2,7 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.memberIsModThrow = exports.memberIsMod = exports.getChannel = exports.getMember = exports.emsg = exports.errorMessage = exports.shuffle = void 0;
|
||||
const discord_js_1 = require("discord.js");
|
||||
const lang_1 = require("./lang");
|
||||
/**
|
||||
* shuffles an array
|
||||
* https://stackoverflow.com/a/2450976/2856416
|
||||
@@ -36,7 +37,7 @@ exports.errorMessage = errorMessage;
|
||||
* @param ephemeral (default=true)
|
||||
* @returns new errorMessage
|
||||
*/
|
||||
const emsg = (msg, ephemeral = true) => new errorMessage(msg, ephemeral);
|
||||
const emsg = (msg, ephemeral = true) => new errorMessage(lang_1.Lang.get(`error.${msg}`), ephemeral);
|
||||
exports.emsg = emsg;
|
||||
/**
|
||||
* get the GuildMember of an interaction
|
||||
@@ -47,7 +48,7 @@ exports.emsg = emsg;
|
||||
function getMember(interaction) {
|
||||
let member = interaction.member;
|
||||
if (!(member instanceof discord_js_1.GuildMember))
|
||||
throw (0, exports.emsg)('Unable to retrieve guild member information, please try again');
|
||||
throw (0, exports.emsg)('general.noMember');
|
||||
return member;
|
||||
}
|
||||
exports.getMember = getMember;
|
||||
@@ -60,7 +61,7 @@ exports.getMember = getMember;
|
||||
function getChannel(interaction) {
|
||||
let channel = interaction.channel;
|
||||
if (!(channel instanceof discord_js_1.TextChannel))
|
||||
throw (0, exports.emsg)('Unable to retrieve text channel information, please try again');
|
||||
throw (0, exports.emsg)('general.noChannel');
|
||||
return channel;
|
||||
}
|
||||
exports.getChannel = getChannel;
|
||||
@@ -71,6 +72,6 @@ function memberIsMod(interaction) {
|
||||
exports.memberIsMod = memberIsMod;
|
||||
function memberIsModThrow(interaction) {
|
||||
if (!memberIsMod(interaction))
|
||||
throw (0, exports.emsg)('Member is not a moderator');
|
||||
throw (0, exports.emsg)('discord.notMod');
|
||||
}
|
||||
exports.memberIsModThrow = memberIsModThrow;
|
||||
|
||||
Reference in New Issue
Block a user