Primeras traducciones
This commit is contained in:
parent
e4a85da900
commit
16b56ba5c5
277
script_hecho.js
277
script_hecho.js
|
@ -2,10 +2,107 @@
|
|||
//
|
||||
// -Momento en el que se cambia al mapa grande, changeToBigMapOn 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 */
|
||||
|
@ -14,10 +111,10 @@ var translations = {
|
|||
|
||||
const roomName = '🇪🇸..3️⃣🆚3️⃣..5️⃣🆚5️⃣..⚽FUTBOL SALA⚽';
|
||||
const maxPlayers = 15;
|
||||
const roomPublic = true;
|
||||
const roomPublic = false;
|
||||
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 fetchRecordingVariable = true;
|
||||
var timeLimit = 7;
|
||||
|
@ -124,7 +221,7 @@ class MutePlayer {
|
|||
setDuration(minutes) {
|
||||
this.unmuteTimeout = setTimeout(() => {
|
||||
room.sendAnnouncement(
|
||||
`You have been unmuted.`,
|
||||
translate('unmute'),
|
||||
this.playerId,
|
||||
announcementColor,
|
||||
"bold",
|
||||
|
@ -248,7 +345,7 @@ var streak = 0;
|
|||
var authArray = [];
|
||||
var adminList = [
|
||||
["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_2', 'NICK_OF_ADMIN_2'],
|
||||
];
|
||||
|
@ -261,11 +358,9 @@ var masterList = [
|
|||
|
||||
var commands = {
|
||||
help: {
|
||||
aliases: ['commands'],
|
||||
aliases: ['comandos'],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
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.`,
|
||||
desc: translate('commands.help'),
|
||||
function: helpCommand,
|
||||
},
|
||||
claim: {
|
||||
|
@ -277,228 +372,175 @@ Example: \'!help bb\' will show the description of the \'bb\' command.`,
|
|||
afk: {
|
||||
aliases: [],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command makes you go AFK.
|
||||
It has constraints: 1 minute minimum of AFK time, 5 minutes maximum and 10 minutes cooldown.`,
|
||||
desc: translate('commands.afk'),
|
||||
function: afkCommand,
|
||||
},
|
||||
afks: {
|
||||
aliases: ['afklist'],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command shows all the players that are AFK.`,
|
||||
desc: translate('commands.afks'),
|
||||
function: afkListCommand,
|
||||
},
|
||||
bb: {
|
||||
aliases: ['bye', 'gn', 'cya'],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command makes you leave instantly (use recommended).`,
|
||||
desc: translate('commands.bb'),
|
||||
function: leaveCommand,
|
||||
},
|
||||
me: {
|
||||
aliases: ['stat', 'stats'],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command shows your global stats in the room.`,
|
||||
desc: translate('commands.me'),
|
||||
function: globalStatsCommand,
|
||||
},
|
||||
rename: {
|
||||
aliases: [],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command allows you to rename yourself for the leaderboard.`,
|
||||
desc: translate('commands.rename'),
|
||||
function: renameCommand,
|
||||
},
|
||||
games: {
|
||||
aliases: [],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command shows the top 5 players with the most games in the room.`,
|
||||
desc: translate('commands.games'),
|
||||
function: statsLeaderboardCommand,
|
||||
},
|
||||
wins: {
|
||||
aliases: [],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command shows the top 5 players with the most wins in the room.`,
|
||||
desc: translate('commands.wins'),
|
||||
function: statsLeaderboardCommand,
|
||||
},
|
||||
goals: {
|
||||
aliases: [],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command shows the top 5 players with the most goals in the room.`,
|
||||
desc: translate('commands.goals'),
|
||||
function: statsLeaderboardCommand,
|
||||
},
|
||||
assists: {
|
||||
aliases: [],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command shows the top 5 players with the most assists in the room.`,
|
||||
desc: translate('commands.assists'),
|
||||
function: statsLeaderboardCommand,
|
||||
},
|
||||
cs: {
|
||||
aliases: [],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command shows the top 5 players with the most CS in the room.`,
|
||||
desc: translate('commands.cs'),
|
||||
function: statsLeaderboardCommand,
|
||||
},
|
||||
playtime: {
|
||||
aliases: [],
|
||||
roles: Role.PLAYER,
|
||||
desc: `
|
||||
This command shows the top 5 players with the most time played in the room.`,
|
||||
desc: translate('commands.playtime'),
|
||||
function: statsLeaderboardCommand,
|
||||
},
|
||||
training: {
|
||||
aliases: [],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
This command loads the classic training stadium.`,
|
||||
desc: translate('commands.training'),
|
||||
function: stadiumCommand,
|
||||
},
|
||||
classic: {
|
||||
aliases: [],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
This command loads the classic stadium.`,
|
||||
desc: translate('commands.classic'),
|
||||
function: stadiumCommand,
|
||||
},
|
||||
big: {
|
||||
aliases: [],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
This command loads the big stadium.`,
|
||||
desc: translate('commands.big'),
|
||||
function: stadiumCommand,
|
||||
},
|
||||
rr: {
|
||||
aliases: [],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
This command restarts the game.`,
|
||||
desc: translate('commands.rr'),
|
||||
function: restartCommand,
|
||||
},
|
||||
rrs: {
|
||||
aliases: [],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
This command swaps the teams and restarts the game.`,
|
||||
desc: translate('commands.rrs'),
|
||||
function: restartSwapCommand,
|
||||
},
|
||||
swap: {
|
||||
aliases: ['s'],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
This command swaps the teams when the game is stopped.`,
|
||||
desc: translate('commands.swap'),
|
||||
function: swapCommand,
|
||||
},
|
||||
kickred: {
|
||||
aliases: ['kickr'],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
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.`,
|
||||
desc: translate('commands.kickred'),
|
||||
function: kickTeamCommand,
|
||||
},
|
||||
kickblue: {
|
||||
aliases: ['kickb'],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
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.`,
|
||||
desc: translate('commands.kickblue'),
|
||||
function: kickTeamCommand,
|
||||
},
|
||||
kickspec: {
|
||||
aliases: ['kicks'],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
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.`,
|
||||
desc: translate('commands.kickspec'),
|
||||
function: kickTeamCommand,
|
||||
},
|
||||
mute: {
|
||||
aliases: ['m'],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
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.`,
|
||||
desc: translate('commands.mute'),
|
||||
function: muteCommand,
|
||||
},
|
||||
unmute: {
|
||||
aliases: ['um'],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
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.`,
|
||||
desc: translate('commands.unmute'),
|
||||
function: unmuteCommand,
|
||||
},
|
||||
mutes: {
|
||||
aliases: [],
|
||||
roles: Role.ADMIN_TEMP,
|
||||
desc: `
|
||||
This command shows the list of muted players.`,
|
||||
desc: translate('commands.mutes'),
|
||||
function: muteListCommand,
|
||||
},
|
||||
clearbans: {
|
||||
aliases: [],
|
||||
roles: Role.MASTER,
|
||||
desc: `
|
||||
This command unbans everyone. It also can unban one player in particular, by adding his ID as an argument.`,
|
||||
desc: translate('commands.clearbans'),
|
||||
function: clearbansCommand,
|
||||
},
|
||||
bans: {
|
||||
aliases: ['banlist'],
|
||||
aliases: ['listaban'],
|
||||
roles: Role.MASTER,
|
||||
desc: `
|
||||
This command shows all the players that were banned and their IDs.`,
|
||||
desc: translate('commands.bans'),
|
||||
function: banListCommand,
|
||||
},
|
||||
admins: {
|
||||
aliases: ['adminlist'],
|
||||
aliases: ['listadmin'],
|
||||
roles: Role.MASTER,
|
||||
desc: `
|
||||
This command shows all the players that are permanent admins.`,
|
||||
desc: translate('commands.admins'),
|
||||
function: adminListCommand,
|
||||
},
|
||||
setadmin: {
|
||||
aliases: ['admin'],
|
||||
roles: Role.MASTER,
|
||||
desc: `
|
||||
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.`,
|
||||
desc: translate('commands.setadmin'),
|
||||
function: setAdminCommand,
|
||||
},
|
||||
removeadmin: {
|
||||
aliases: ['unadmin'],
|
||||
roles: Role.MASTER,
|
||||
desc: `
|
||||
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.`,
|
||||
desc: translate('commands.removeadmin'),
|
||||
function: removeAdminCommand,
|
||||
},
|
||||
password: {
|
||||
aliases: ['pw'],
|
||||
roles: Role.MASTER,
|
||||
desc: `
|
||||
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'.`,
|
||||
desc: translate('commands.password'),
|
||||
function: passwordCommand,
|
||||
},
|
||||
};
|
||||
|
@ -749,7 +791,7 @@ function playerChat(player, message) {
|
|||
);
|
||||
if (playerTargetIndex == -1) {
|
||||
room.sendAnnouncement(
|
||||
`Invalid player, make sure the name you entered is correct.`,
|
||||
translate("invalidPlayer"),
|
||||
player.id,
|
||||
errorColor,
|
||||
'bold',
|
||||
|
@ -760,7 +802,7 @@ function playerChat(player, message) {
|
|||
var playerTarget = playersAll[playerTargetIndex];
|
||||
if (player.id == playerTarget.id) {
|
||||
room.sendAnnouncement(
|
||||
`You can't send a PM to yourself!`,
|
||||
translate("pmYourself"),
|
||||
player.id,
|
||||
errorColor,
|
||||
'bold',
|
||||
|
@ -768,9 +810,9 @@ function playerChat(player, message) {
|
|||
);
|
||||
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(
|
||||
messageFrom,
|
||||
|
@ -933,7 +975,7 @@ function helpCommand(player, message) {
|
|||
if (commandString.slice(commandString.length - 1) == ':') commandString += ` None,`;
|
||||
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(
|
||||
commandString,
|
||||
player.id,
|
||||
|
@ -945,7 +987,7 @@ function helpCommand(player, message) {
|
|||
var commandName = getCommand(msgArray[0].toLowerCase());
|
||||
if (commandName != false && commands[commandName].desc != false)
|
||||
room.sendAnnouncement(
|
||||
`\'${commandName}\' command :\n${commands[commandName].desc}`,
|
||||
`\'${commandName}\' ${translate("command")} :\n${commands[commandName].desc}`,
|
||||
player.id,
|
||||
infoColor,
|
||||
'bold',
|
||||
|
@ -953,7 +995,7 @@ function helpCommand(player, message) {
|
|||
);
|
||||
else
|
||||
room.sendAnnouncement(
|
||||
`The command you tried to get information on does not exist. To check all available commands, type \'!help\'`,
|
||||
translate("invalidCommand"),
|
||||
player.id,
|
||||
errorColor,
|
||||
'bold',
|
||||
|
@ -988,7 +1030,7 @@ function renameCommand(player, message) {
|
|||
}
|
||||
localStorage.setItem(authArray[player.id][0], JSON.stringify(stats));
|
||||
room.sendAnnouncement(
|
||||
`You successfully renamed yourself ${stats.playerName} !`,
|
||||
translate('changeUsername', { name: stats.playerName }),
|
||||
player.id,
|
||||
successColor,
|
||||
'bold',
|
||||
|
@ -996,7 +1038,7 @@ function renameCommand(player, message) {
|
|||
);
|
||||
} else {
|
||||
room.sendAnnouncement(
|
||||
`You haven't played a game in this room yet !`,
|
||||
translate("haventPlayed"),
|
||||
player.id,
|
||||
errorColor,
|
||||
'bold',
|
||||
|
@ -1015,7 +1057,7 @@ function afkCommand(player, message) {
|
|||
if (AFKSet.has(player.id)) {
|
||||
if (AFKMinSet.has(player.id)) {
|
||||
room.sendAnnouncement(
|
||||
`There is a minimum of ${minAFKDuration} minute of AFK time. Don't abuse the command !`,
|
||||
translate('minAfk', { min: minAFKDuration }),
|
||||
player.id,
|
||||
errorColor,
|
||||
'bold',
|
||||
|
@ -1024,7 +1066,7 @@ function afkCommand(player, message) {
|
|||
} else {
|
||||
AFKSet.delete(player.id);
|
||||
room.sendAnnouncement(
|
||||
`🌅 ${player.name} is not AFK anymore !`,
|
||||
translate('noAfk', { player: player.name }),
|
||||
null,
|
||||
announcementColor,
|
||||
'bold',
|
||||
|
@ -1036,7 +1078,7 @@ function afkCommand(player, message) {
|
|||
} else {
|
||||
if (AFKCooldownSet.has(player.id)) {
|
||||
room.sendAnnouncement(
|
||||
`You can only go AFK every ${AFKCooldown} minutes. Don't abuse the command !`,
|
||||
translate('everyAfk', { min: AFKCooldown }),
|
||||
player.id,
|
||||
errorColor,
|
||||
'bold',
|
||||
|
@ -1071,7 +1113,7 @@ function afkCommand(player, message) {
|
|||
}
|
||||
room.setPlayerTeam(player.id, Team.SPECTATORS);
|
||||
room.sendAnnouncement(
|
||||
`😴 ${player.name} is now AFK !`,
|
||||
translate('nowAfk', { player: player.name }),
|
||||
null,
|
||||
announcementColor,
|
||||
'bold',
|
||||
|
@ -1083,7 +1125,7 @@ function afkCommand(player, message) {
|
|||
}
|
||||
} else {
|
||||
room.sendAnnouncement(
|
||||
`You can't go AFK while in a team !`,
|
||||
translate("cantAfk"),
|
||||
player.id,
|
||||
errorColor,
|
||||
'bold',
|
||||
|
@ -1095,7 +1137,7 @@ function afkCommand(player, message) {
|
|||
function afkListCommand(player, message) {
|
||||
if (AFKSet.size == 0) {
|
||||
room.sendAnnouncement(
|
||||
"😴 There's nobody in the AFK list.",
|
||||
translate("nobodyAfk"),
|
||||
player.id,
|
||||
announcementColor,
|
||||
'bold',
|
||||
|
@ -1103,7 +1145,7 @@ function afkListCommand(player, message) {
|
|||
);
|
||||
return;
|
||||
}
|
||||
var cstm = '😴 AFK list : ';
|
||||
var cstm = translate("listAfk");
|
||||
AFKSet.forEach((_, value) => {
|
||||
var p = room.getPlayer(value);
|
||||
if (p != null) cstm += p.name + `, `;
|
||||
|
@ -1120,7 +1162,7 @@ function masterCommand(player, message) {
|
|||
adminList = adminList.filter((a) => a[0] != authArray[player.id][0]);
|
||||
masterList.push(authArray[player.id][0]);
|
||||
room.sendAnnouncement(
|
||||
`${player.name} is now a room master !`,
|
||||
translate("nowMaster", { player: player.name}),
|
||||
null,
|
||||
announcementColor,
|
||||
'bold',
|
||||
|
@ -1128,7 +1170,7 @@ function masterCommand(player, message) {
|
|||
);
|
||||
} else {
|
||||
room.sendAnnouncement(
|
||||
`You are a master already !`,
|
||||
translate("alreadyMaster"),
|
||||
player.id,
|
||||
errorColor,
|
||||
'bold',
|
||||
|
@ -1156,7 +1198,7 @@ function swapCommand(player, message) {
|
|||
if (playSituation == Situation.STOP) {
|
||||
swapButton();
|
||||
room.sendAnnouncement(
|
||||
'✔️ Teams swapped !',
|
||||
translate("teamsSwapped"),
|
||||
null,
|
||||
announcementColor,
|
||||
'bold',
|
||||
|
@ -1164,7 +1206,7 @@ function swapCommand(player, message) {
|
|||
);
|
||||
} else {
|
||||
room.sendAnnouncement(
|
||||
`Please stop the game before swapping.`,
|
||||
translate("stopBeforeSwap"),
|
||||
player.id,
|
||||
errorColor,
|
||||
'bold',
|
||||
|
@ -3197,7 +3239,6 @@ function fetchSummaryEmbed(game) {
|
|||
/* EVENTS */
|
||||
|
||||
/* PLAYER MOVEMENT */
|
||||
|
||||
room.onPlayerJoin = function (player) {
|
||||
authArray[player.id] = [player.auth, player.conn];
|
||||
if (roomWebhook != '') {
|
||||
|
@ -3214,7 +3255,7 @@ room.onPlayerJoin = function (player) {
|
|||
}).then((res) => res);
|
||||
}
|
||||
room.sendAnnouncement(
|
||||
translations.wellcome,
|
||||
translate('wellcome', { name: player.name }),
|
||||
player.id,
|
||||
welcomeColor,
|
||||
'bold',
|
||||
|
@ -3601,7 +3642,7 @@ room.onRoomLink = function (url) {
|
|||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
content: `[${getDate()}] 🔗 LINK ${url}\nmasterPassword : ${masterPassword}`,
|
||||
username: roomName,
|
||||
username: "HAXBALL SERVER",
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
Loading…
Reference in New Issue
Block a user