Primeras traducciones

This commit is contained in:
borrageiros 2024-05-15 15:02:44 +02:00
parent e4a85da900
commit 16b56ba5c5

View File

@ -2,10 +2,107 @@
// //
// -Momento en el que se cambia al mapa grande, changeToBigMapOn variable // -Momento en el que se cambia al mapa grande, changeToBigMapOn variable
// -Momento en el que se cambia al mapa pequeño, changeToClassicMapOn variable // -Momento en el que se cambia al mapa pequeño, changeToClassicMapOn variable
var translations = { //
wellcome: `👋 Welcome ${player.name} !\nEnter "t" before your message to use team chat and "@@" followed by a player name to PM him !` // -Traducciones
// USO:
// translate('example', { exampleVariable: "texto de ejemplo" }),
// translate('exampleWithOutVariable'),
function translate(key, args) {
try {
var str = key.split('.').reduce((obj, i) => obj[i], translations);
if (!args) return str;
return str.replace(/\${(.*?)}/g, (match, key) => args[key.trim()]);
} catch (error) {
console.error("Translation error:", error);
return "";
} }
// CHANGES BY BORRAGEIROS }
var translations = {
example: `Esto es un ejemplo de uso. Ejemplo de variable: \${exampleVariable}`,
exampleWithOutVariable: `Esto es un ejemplo de uso sin variable.`,
///////////////
wellcome: `👋 ¡Bienvenido \${name}! \n¡Escribe "t" antes de tu mensaje para usar el chat de equipo y "@@" seguido del nombre de un jugador para enviarle un mensaje privado!`,
commands: {
help: `Este comando muestra todos los comandos disponibles. También puede mostrar la descripción de un comando en particular.
Ejemplo: '!help bb' mostrará la descripción del comando '!bb'.`,
claim: "reclamar",
afk: `Este comando te pone en modo AFK.
Tiene restricciones: un mínimo de 1 minuto de tiempo AFK, un máximo de 5 minutos y un tiempo de enfriamiento de 10 minutos.`,
afks: "Este comando muestra todos los jugadores que están AFK.",
bb: "Este comando te hace salir instantáneamente (uso recomendado).",
me: "Este comando muestra tus estadísticas globales en la sala.",
rename: "Este comando te permite cambiar tu nombre para el marcador.",
games: "Este comando muestra a los 5 mejores jugadores con más partidas en la sala.",
wins: "Este comando muestra a los 5 mejores jugadores con más victorias en la sala.",
goals: "Este comando muestra a los 5 mejores jugadores con más goles en la sala.",
assists: "Este comando muestra a los 5 mejores jugadores con más asistencias en la sala.",
cs: "Este comando muestra a los 5 mejores jugadores con más CS en la sala.",
playtime: "Este comando muestra a los 5 mejores jugadores con más tiempo jugado en la sala.",
training: "Este comando carga el estadio de entrenamiento clásico.",
classic: "Este comando carga el estadio clásico.",
big: "Este comando carga el estadio grande.",
rr: "Este comando reinicia el juego.",
rrs: "Este comando intercambia los equipos y reinicia el juego.",
swap: "Este comando intercambia los equipos cuando el juego está detenido.",
kickred: "Este comando expulsa a todos los jugadores del equipo rojo, incluido el jugador que introdujo el comando. Puedes proporcionar como argumento la razón de la expulsión.",
kickblue: "Este comando expulsa a todos los jugadores del equipo azul, incluido el jugador que introdujo el comando. Puedes proporcionar como argumento la razón de la expulsión.",
kickspec: "Este comando expulsa a todos los jugadores del equipo de espectadores, incluido el jugador que introdujo el comando. Puedes proporcionar como argumento la razón de la expulsión.",
mute: `Este comando permite silenciar a un jugador. No podrá hablar durante una cierta duración y puede ser desmutado en cualquier momento por los administradores.
Toma 2 argumentos:
Argumento 1: #<id> donde <id> es el id del jugador objetivo. Esto no funcionará si el jugador es un administrador.
Argumento 2 (opcional): <duración> donde <duración> es la duración del mute en minutos. Si no se proporciona ningún valor, el mute dura la duración predeterminada, 5 minutos.
Ejemplo: '!mute #3 20' silenciará al jugador con id 3 durante 20 minutos.`,
unmute: `Este comando permite desmutear a alguien.
Toma 1 argumento:
Argumento 1: #<id> donde <id> es el id del jugador silenciado.
O
Argumento 1: <número> donde <número> es el número asociado con el mute dado por el comando 'muteList'.
Ejemplo: '!unmute #300' desmuteará al jugador con id 300,
'!unmute 8' desmuteará al jugador n°8 según el comando 'muteList'.`,
mutes: "Este comando muestra la lista de jugadores silenciados.",
clearbans: `Este comando desbanea a todos. También puede desbanear a un jugador en particular, añadiendo su ID como argumento.`,
bans: "Este comando muestra a todos los jugadores que fueron baneados y sus IDs.",
admins: "Este comando muestra a todos los jugadores que son administradores permanentes.",
setadmin: `Este comando permite convertir a alguien en administrador. Podrá conectarse como administrador y puede ser eliminado en cualquier momento por los maestros.
Toma 1 argumento:
Argumento 1: #<id> donde <id> es el id del jugador objetivo.
Ejemplo: '!setadmin #3' dará administrador al jugador con id 3.`,
removeadmin: `Este comando permite quitar a alguien como administrador.
Toma 1 argumento:
Argumento 1: #<id> donde <id> es el id del jugador objetivo.
O
Argumento 1: <número> donde <número> es el número asociado con el administrador dado por el comando 'admins'.
Ejemplo: '!removeadmin #300' quitará el administrador al jugador con id 300,
'!removeadmin 2' quitará el administrador n°2 según el comando 'admins'.`,
password: `Este comando permite agregar una contraseña a la sala.
Toma 1 argumento:
Argumento 1: <contraseña> donde <contraseña> es la contraseña que deseas para la sala.
Para eliminar la contraseña de la sala, simplemente introduce '!password'.`,
},
unmute: `Estás desmuteado.`,
invalidPlayer: `Jugador inválido, asegurate de que el nombre es correcto.`,
pmYourself: `No puedes enviarte un mensaje privado a ti mismo`,
with: `con`,
commandsInfo: `\nPara informarte sobre un comando, escribe '!help <command name>'`,
command: `comando`,
invalidCommand: `El comando que deseas comprobar no existe, Para ver los comandos existentes, escribe \'!help\'`,
changeUsername: `Te has cambiado el nombre \${name}`,
haventPlayed: `Todavía no has jugado en esta sala!`,
minAfk: `Hay un mínimo de \${min} minutos de AFK. No abuses del comando!`,
noAfk: `🌅 \${player} ya no está AFK!`,
everyAfk: `Solo puedes ir AFK cada \${min} minutos. No abuses del comando!`,
nowAfk: `😴 \${player} está AFK!`,
cantAfk: `No puedes ir AFK si estás en un equipo!`,
nobodyAfk: `😴 No hay nadie en la lista AFK`,
listAfk: `😴 Lista AFK: `,
nowMaster: `\${player} es ahora un room master!`,
alreadyMaster: `Ya eres un room master!`,
teamsSwapped: `✔️ Equipos swapeados`,
stopBeforeSwap: `Por favor, para el juego antes de swapear`
}
// FIN CHANGES BY BORRAGEIROS
/* VARIABLES */ /* VARIABLES */
@ -14,10 +111,10 @@ var translations = {
const roomName = '🇪🇸..3⃣🆚3⃣..5⃣🆚5⃣..⚽FUTBOL SALA⚽'; const roomName = '🇪🇸..3⃣🆚3⃣..5⃣🆚5⃣..⚽FUTBOL SALA⚽';
const maxPlayers = 15; const maxPlayers = 15;
const roomPublic = true; const roomPublic = false;
const token = ""; // Insert token here const token = ""; // Insert token here
var roomWebhook = ''; // this webhook is used to send the details of the room (chat, join, leave) ; it should be in a private discord channel var roomWebhook = 'https://discord.com/api/webhooks/1240281077176864802/S3g6mEmedG8ae-8G8RGAqh48N36tmzO0FWa2IPTguVxvQjnzTj4tQ19_gLiz9_oJctDC'; // this webhook is used to send the details of the room (chat, join, leave) ; it should be in a private discord channel
var gameWebhook = ''; // this webhook is used to send the summary of the games ; it should be in a public discord channel var gameWebhook = ''; // this webhook is used to send the summary of the games ; it should be in a public discord channel
var fetchRecordingVariable = true; var fetchRecordingVariable = true;
var timeLimit = 7; var timeLimit = 7;
@ -124,7 +221,7 @@ class MutePlayer {
setDuration(minutes) { setDuration(minutes) {
this.unmuteTimeout = setTimeout(() => { this.unmuteTimeout = setTimeout(() => {
room.sendAnnouncement( room.sendAnnouncement(
`You have been unmuted.`, translate('unmute'),
this.playerId, this.playerId,
announcementColor, announcementColor,
"bold", "bold",
@ -248,7 +345,7 @@ var streak = 0;
var authArray = []; var authArray = [];
var adminList = [ var adminList = [
["amuZ3Vk-M6Vk8_DuphOjismmfRRo4SQ44RyUuLb9nLc", "borrageiros"], // borrageiros ["amuZ3Vk-M6Vk8_DuphOjismmfRRo4SQ44RyUuLb9nLc", "borrageiros"], // borrageiros
["_LSQgSnedi0Y2E86tf5-ql6fLYORVHUDsEvilNFXKA4", "El santo"] // xoel // ["_LSQgSnedi0Y2E86tf5-ql6fLYORVHUDsEvilNFXKA4", "El santo"] // xoel
// ['INSERT_AUTH_HERE_1', 'NICK_OF_ADMIN_1'], // ['INSERT_AUTH_HERE_1', 'NICK_OF_ADMIN_1'],
// ['INSERT_AUTH_HERE_2', 'NICK_OF_ADMIN_2'], // ['INSERT_AUTH_HERE_2', 'NICK_OF_ADMIN_2'],
]; ];
@ -261,11 +358,9 @@ var masterList = [
var commands = { var commands = {
help: { help: {
aliases: ['commands'], aliases: ['comandos'],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.help'),
This command shows all the available commands. It also can show the description of a command in particular.
Example: \'!help bb\' will show the description of the \'bb\' command.`,
function: helpCommand, function: helpCommand,
}, },
claim: { claim: {
@ -277,228 +372,175 @@ Example: \'!help bb\' will show the description of the \'bb\' command.`,
afk: { afk: {
aliases: [], aliases: [],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.afk'),
This command makes you go AFK.
It has constraints: 1 minute minimum of AFK time, 5 minutes maximum and 10 minutes cooldown.`,
function: afkCommand, function: afkCommand,
}, },
afks: { afks: {
aliases: ['afklist'], aliases: ['afklist'],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.afks'),
This command shows all the players that are AFK.`,
function: afkListCommand, function: afkListCommand,
}, },
bb: { bb: {
aliases: ['bye', 'gn', 'cya'], aliases: ['bye', 'gn', 'cya'],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.bb'),
This command makes you leave instantly (use recommended).`,
function: leaveCommand, function: leaveCommand,
}, },
me: { me: {
aliases: ['stat', 'stats'], aliases: ['stat', 'stats'],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.me'),
This command shows your global stats in the room.`,
function: globalStatsCommand, function: globalStatsCommand,
}, },
rename: { rename: {
aliases: [], aliases: [],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.rename'),
This command allows you to rename yourself for the leaderboard.`,
function: renameCommand, function: renameCommand,
}, },
games: { games: {
aliases: [], aliases: [],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.games'),
This command shows the top 5 players with the most games in the room.`,
function: statsLeaderboardCommand, function: statsLeaderboardCommand,
}, },
wins: { wins: {
aliases: [], aliases: [],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.wins'),
This command shows the top 5 players with the most wins in the room.`,
function: statsLeaderboardCommand, function: statsLeaderboardCommand,
}, },
goals: { goals: {
aliases: [], aliases: [],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.goals'),
This command shows the top 5 players with the most goals in the room.`,
function: statsLeaderboardCommand, function: statsLeaderboardCommand,
}, },
assists: { assists: {
aliases: [], aliases: [],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.assists'),
This command shows the top 5 players with the most assists in the room.`,
function: statsLeaderboardCommand, function: statsLeaderboardCommand,
}, },
cs: { cs: {
aliases: [], aliases: [],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.cs'),
This command shows the top 5 players with the most CS in the room.`,
function: statsLeaderboardCommand, function: statsLeaderboardCommand,
}, },
playtime: { playtime: {
aliases: [], aliases: [],
roles: Role.PLAYER, roles: Role.PLAYER,
desc: ` desc: translate('commands.playtime'),
This command shows the top 5 players with the most time played in the room.`,
function: statsLeaderboardCommand, function: statsLeaderboardCommand,
}, },
training: { training: {
aliases: [], aliases: [],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.training'),
This command loads the classic training stadium.`,
function: stadiumCommand, function: stadiumCommand,
}, },
classic: { classic: {
aliases: [], aliases: [],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.classic'),
This command loads the classic stadium.`,
function: stadiumCommand, function: stadiumCommand,
}, },
big: { big: {
aliases: [], aliases: [],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.big'),
This command loads the big stadium.`,
function: stadiumCommand, function: stadiumCommand,
}, },
rr: { rr: {
aliases: [], aliases: [],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.rr'),
This command restarts the game.`,
function: restartCommand, function: restartCommand,
}, },
rrs: { rrs: {
aliases: [], aliases: [],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.rrs'),
This command swaps the teams and restarts the game.`,
function: restartSwapCommand, function: restartSwapCommand,
}, },
swap: { swap: {
aliases: ['s'], aliases: ['s'],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.swap'),
This command swaps the teams when the game is stopped.`,
function: swapCommand, function: swapCommand,
}, },
kickred: { kickred: {
aliases: ['kickr'], aliases: ['kickr'],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.kickred'),
This command kicks all the players from the red team, including the player that entered the command. You can give as an argument the reason of the kick.`,
function: kickTeamCommand, function: kickTeamCommand,
}, },
kickblue: { kickblue: {
aliases: ['kickb'], aliases: ['kickb'],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.kickblue'),
This command kicks all the players from the blue team, including the player that entered the command. You can give as an argument the reason of the kick.`,
function: kickTeamCommand, function: kickTeamCommand,
}, },
kickspec: { kickspec: {
aliases: ['kicks'], aliases: ['kicks'],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.kickspec'),
This command kicks all the players from the spectators team, including the player that entered the command. You can give as an argument the reason of the kick.`,
function: kickTeamCommand, function: kickTeamCommand,
}, },
mute: { mute: {
aliases: ['m'], aliases: ['m'],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.mute'),
This command allows to mute a player. He won't be able to talk for a certain duration, and can be unmuted at any time by admins.
It takes 2 arguments:
Argument 1: #<id> where <id> is the id of the player targeted. This won't work if the player is an admin.
Argument 2 (optional): <duration> where <duration> is the duration of the mute in minutes. If no value is provided, the mute lasts for the default duration, ${muteDuration} minutes.
Example: !mute #3 20 will mute the player with id 3 for 20 minutes.`,
function: muteCommand, function: muteCommand,
}, },
unmute: { unmute: {
aliases: ['um'], aliases: ['um'],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.unmute'),
This command allows to unmute someone.
It takes 1 argument:
Argument 1: #<id> where <id> is the id of the muted player.
OR
Argument 1: <number> where <number> is the number associated with the mute given by the 'muteList' command.
Example: !unmute #300 will unmute the player with id 300,
!unmute 8 will unmute the n°8 player according to the 'muteList' command.`,
function: unmuteCommand, function: unmuteCommand,
}, },
mutes: { mutes: {
aliases: [], aliases: [],
roles: Role.ADMIN_TEMP, roles: Role.ADMIN_TEMP,
desc: ` desc: translate('commands.mutes'),
This command shows the list of muted players.`,
function: muteListCommand, function: muteListCommand,
}, },
clearbans: { clearbans: {
aliases: [], aliases: [],
roles: Role.MASTER, roles: Role.MASTER,
desc: ` desc: translate('commands.clearbans'),
This command unbans everyone. It also can unban one player in particular, by adding his ID as an argument.`,
function: clearbansCommand, function: clearbansCommand,
}, },
bans: { bans: {
aliases: ['banlist'], aliases: ['listaban'],
roles: Role.MASTER, roles: Role.MASTER,
desc: ` desc: translate('commands.bans'),
This command shows all the players that were banned and their IDs.`,
function: banListCommand, function: banListCommand,
}, },
admins: { admins: {
aliases: ['adminlist'], aliases: ['listadmin'],
roles: Role.MASTER, roles: Role.MASTER,
desc: ` desc: translate('commands.admins'),
This command shows all the players that are permanent admins.`,
function: adminListCommand, function: adminListCommand,
}, },
setadmin: { setadmin: {
aliases: ['admin'], aliases: ['admin'],
roles: Role.MASTER, roles: Role.MASTER,
desc: ` desc: translate('commands.setadmin'),
This command allows to set someone as admin. He will be able to connect as admin, and can be removed at any time by masters.
It takes 1 argument:
Argument 1: #<id> where <id> is the id of the player targeted.
Example: !setadmin #3 will give admin to the player with id 3.`,
function: setAdminCommand, function: setAdminCommand,
}, },
removeadmin: { removeadmin: {
aliases: ['unadmin'], aliases: ['unadmin'],
roles: Role.MASTER, roles: Role.MASTER,
desc: ` desc: translate('commands.removeadmin'),
This command allows to remove someone as admin.
It takes 1 argument:
Argument 1: #<id> where <id> is the id of the player targeted.
OR
Argument 1: <number> where <number> is the number associated with the admin given by the 'admins' command.
Example: !removeadmin #300 will remove admin to the player with id 300,
!removeadmin 2 will remove the admin n°2 according to the 'admins' command.`,
function: removeAdminCommand, function: removeAdminCommand,
}, },
password: { password: {
aliases: ['pw'], aliases: ['pw'],
roles: Role.MASTER, roles: Role.MASTER,
desc: ` desc: translate('commands.password'),
This command allows to add a password to the room.
It takes 1 argument:
Argument 1: <password> where <password> is the password you want for the room.
To remove the room password, simply enter '!password'.`,
function: passwordCommand, function: passwordCommand,
}, },
}; };
@ -749,7 +791,7 @@ function playerChat(player, message) {
); );
if (playerTargetIndex == -1) { if (playerTargetIndex == -1) {
room.sendAnnouncement( room.sendAnnouncement(
`Invalid player, make sure the name you entered is correct.`, translate("invalidPlayer"),
player.id, player.id,
errorColor, errorColor,
'bold', 'bold',
@ -760,7 +802,7 @@ function playerChat(player, message) {
var playerTarget = playersAll[playerTargetIndex]; var playerTarget = playersAll[playerTargetIndex];
if (player.id == playerTarget.id) { if (player.id == playerTarget.id) {
room.sendAnnouncement( room.sendAnnouncement(
`You can't send a PM to yourself!`, translate("pmYourself"),
player.id, player.id,
errorColor, errorColor,
'bold', 'bold',
@ -768,9 +810,9 @@ function playerChat(player, message) {
); );
return false; return false;
} }
var messageFrom = `📝 [PM with ${playerTarget.name}] ${player.name}: ${msgArray.slice(1).join(' ')}` var messageFrom = `📝 [PM ${translate("with")} ${playerTarget.name}] ${player.name}: ${msgArray.slice(1).join(' ')}`
var messageTo = `📝 [PM with ${player.name}] ${player.name}: ${msgArray.slice(1).join(' ')}` var messageTo = `📝 [PM ${translate("with")} ${player.name}] ${player.name}: ${msgArray.slice(1).join(' ')}`
room.sendAnnouncement( room.sendAnnouncement(
messageFrom, messageFrom,
@ -933,7 +975,7 @@ function helpCommand(player, message) {
if (commandString.slice(commandString.length - 1) == ':') commandString += ` None,`; if (commandString.slice(commandString.length - 1) == ':') commandString += ` None,`;
commandString = commandString.substring(0, commandString.length - 1) + '.\n'; commandString = commandString.substring(0, commandString.length - 1) + '.\n';
} }
commandString += "\nTo get information on a specific command, type ''!help <command name>'."; commandString += translate("commandsInfo");
room.sendAnnouncement( room.sendAnnouncement(
commandString, commandString,
player.id, player.id,
@ -945,7 +987,7 @@ function helpCommand(player, message) {
var commandName = getCommand(msgArray[0].toLowerCase()); var commandName = getCommand(msgArray[0].toLowerCase());
if (commandName != false && commands[commandName].desc != false) if (commandName != false && commands[commandName].desc != false)
room.sendAnnouncement( room.sendAnnouncement(
`\'${commandName}\' command :\n${commands[commandName].desc}`, `\'${commandName}\' ${translate("command")} :\n${commands[commandName].desc}`,
player.id, player.id,
infoColor, infoColor,
'bold', 'bold',
@ -953,7 +995,7 @@ function helpCommand(player, message) {
); );
else else
room.sendAnnouncement( room.sendAnnouncement(
`The command you tried to get information on does not exist. To check all available commands, type \'!help\'`, translate("invalidCommand"),
player.id, player.id,
errorColor, errorColor,
'bold', 'bold',
@ -988,7 +1030,7 @@ function renameCommand(player, message) {
} }
localStorage.setItem(authArray[player.id][0], JSON.stringify(stats)); localStorage.setItem(authArray[player.id][0], JSON.stringify(stats));
room.sendAnnouncement( room.sendAnnouncement(
`You successfully renamed yourself ${stats.playerName} !`, translate('changeUsername', { name: stats.playerName }),
player.id, player.id,
successColor, successColor,
'bold', 'bold',
@ -996,7 +1038,7 @@ function renameCommand(player, message) {
); );
} else { } else {
room.sendAnnouncement( room.sendAnnouncement(
`You haven't played a game in this room yet !`, translate("haventPlayed"),
player.id, player.id,
errorColor, errorColor,
'bold', 'bold',
@ -1015,7 +1057,7 @@ function afkCommand(player, message) {
if (AFKSet.has(player.id)) { if (AFKSet.has(player.id)) {
if (AFKMinSet.has(player.id)) { if (AFKMinSet.has(player.id)) {
room.sendAnnouncement( room.sendAnnouncement(
`There is a minimum of ${minAFKDuration} minute of AFK time. Don't abuse the command !`, translate('minAfk', { min: minAFKDuration }),
player.id, player.id,
errorColor, errorColor,
'bold', 'bold',
@ -1024,7 +1066,7 @@ function afkCommand(player, message) {
} else { } else {
AFKSet.delete(player.id); AFKSet.delete(player.id);
room.sendAnnouncement( room.sendAnnouncement(
`🌅 ${player.name} is not AFK anymore !`, translate('noAfk', { player: player.name }),
null, null,
announcementColor, announcementColor,
'bold', 'bold',
@ -1036,7 +1078,7 @@ function afkCommand(player, message) {
} else { } else {
if (AFKCooldownSet.has(player.id)) { if (AFKCooldownSet.has(player.id)) {
room.sendAnnouncement( room.sendAnnouncement(
`You can only go AFK every ${AFKCooldown} minutes. Don't abuse the command !`, translate('everyAfk', { min: AFKCooldown }),
player.id, player.id,
errorColor, errorColor,
'bold', 'bold',
@ -1071,7 +1113,7 @@ function afkCommand(player, message) {
} }
room.setPlayerTeam(player.id, Team.SPECTATORS); room.setPlayerTeam(player.id, Team.SPECTATORS);
room.sendAnnouncement( room.sendAnnouncement(
`😴 ${player.name} is now AFK !`, translate('nowAfk', { player: player.name }),
null, null,
announcementColor, announcementColor,
'bold', 'bold',
@ -1083,7 +1125,7 @@ function afkCommand(player, message) {
} }
} else { } else {
room.sendAnnouncement( room.sendAnnouncement(
`You can't go AFK while in a team !`, translate("cantAfk"),
player.id, player.id,
errorColor, errorColor,
'bold', 'bold',
@ -1095,7 +1137,7 @@ function afkCommand(player, message) {
function afkListCommand(player, message) { function afkListCommand(player, message) {
if (AFKSet.size == 0) { if (AFKSet.size == 0) {
room.sendAnnouncement( room.sendAnnouncement(
"😴 There's nobody in the AFK list.", translate("nobodyAfk"),
player.id, player.id,
announcementColor, announcementColor,
'bold', 'bold',
@ -1103,7 +1145,7 @@ function afkListCommand(player, message) {
); );
return; return;
} }
var cstm = '😴 AFK list : '; var cstm = translate("listAfk");
AFKSet.forEach((_, value) => { AFKSet.forEach((_, value) => {
var p = room.getPlayer(value); var p = room.getPlayer(value);
if (p != null) cstm += p.name + `, `; if (p != null) cstm += p.name + `, `;
@ -1120,7 +1162,7 @@ function masterCommand(player, message) {
adminList = adminList.filter((a) => a[0] != authArray[player.id][0]); adminList = adminList.filter((a) => a[0] != authArray[player.id][0]);
masterList.push(authArray[player.id][0]); masterList.push(authArray[player.id][0]);
room.sendAnnouncement( room.sendAnnouncement(
`${player.name} is now a room master !`, translate("nowMaster", { player: player.name}),
null, null,
announcementColor, announcementColor,
'bold', 'bold',
@ -1128,7 +1170,7 @@ function masterCommand(player, message) {
); );
} else { } else {
room.sendAnnouncement( room.sendAnnouncement(
`You are a master already !`, translate("alreadyMaster"),
player.id, player.id,
errorColor, errorColor,
'bold', 'bold',
@ -1156,7 +1198,7 @@ function swapCommand(player, message) {
if (playSituation == Situation.STOP) { if (playSituation == Situation.STOP) {
swapButton(); swapButton();
room.sendAnnouncement( room.sendAnnouncement(
'✔️ Teams swapped !', translate("teamsSwapped"),
null, null,
announcementColor, announcementColor,
'bold', 'bold',
@ -1164,7 +1206,7 @@ function swapCommand(player, message) {
); );
} else { } else {
room.sendAnnouncement( room.sendAnnouncement(
`Please stop the game before swapping.`, translate("stopBeforeSwap"),
player.id, player.id,
errorColor, errorColor,
'bold', 'bold',
@ -3197,7 +3239,6 @@ function fetchSummaryEmbed(game) {
/* EVENTS */ /* EVENTS */
/* PLAYER MOVEMENT */ /* PLAYER MOVEMENT */
room.onPlayerJoin = function (player) { room.onPlayerJoin = function (player) {
authArray[player.id] = [player.auth, player.conn]; authArray[player.id] = [player.auth, player.conn];
if (roomWebhook != '') { if (roomWebhook != '') {
@ -3214,7 +3255,7 @@ room.onPlayerJoin = function (player) {
}).then((res) => res); }).then((res) => res);
} }
room.sendAnnouncement( room.sendAnnouncement(
translations.wellcome, translate('wellcome', { name: player.name }),
player.id, player.id,
welcomeColor, welcomeColor,
'bold', 'bold',
@ -3601,7 +3642,7 @@ room.onRoomLink = function (url) {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
content: `[${getDate()}] 🔗 LINK ${url}\nmasterPassword : ${masterPassword}`, content: `[${getDate()}] 🔗 LINK ${url}\nmasterPassword : ${masterPassword}`,
username: roomName, username: "HAXBALL SERVER",
}), }),
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',