Discord WebHook name

This commit is contained in:
borrageiros 2024-05-15 15:10:31 +02:00
parent 30c8c26e18
commit 5c32992bcb

View File

@ -115,6 +115,7 @@ const roomPublic = true;
const token = ""; // Insert token here
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 webhookName = "HAXBALL SERVER";
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;
@ -3247,7 +3248,7 @@ room.onPlayerJoin = function (player) {
body: JSON.stringify({
content: `[${getDate()}] ➡️ JOIN (${playersAll.length + 1}/${maxPlayers})\n**` +
`${player.name}** [${authArray[player.id][0]}] {${authArray[player.id][1]}}`,
username: roomName,
username: webhookName,
}),
headers: {
'Content-Type': 'application/json',
@ -3325,7 +3326,7 @@ room.onPlayerLeave = function (player) {
method: 'POST',
body: JSON.stringify({
content: stringContent,
username: roomName,
username: webhookName,
}),
headers: {
'Content-Type': 'application/json',
@ -3351,7 +3352,7 @@ room.onPlayerKicked = function (kickedPlayer, reason, ban, byPlayer) {
method: 'POST',
body: JSON.stringify({
content: stringContent,
username: roomName,
username: webhookName,
}),
headers: {
'Content-Type': 'application/json',
@ -3392,7 +3393,7 @@ room.onPlayerChat = function (player, message) {
method: 'POST',
body: JSON.stringify({
content: `[${getDate()}] 💬 CHAT\n**${player.name}** : ${message.replace('@', '@ ')}`,
username: roomName,
username: webhookName,
}),
headers: {
'Content-Type': 'application/json',
@ -3611,7 +3612,7 @@ room.onTeamGoal = function (team) {
method: 'POST',
body: JSON.stringify({
content: `[${getDate()}] ${goalString}`,
username: roomName,
username: webhookName,
}),
headers: {
'Content-Type': 'application/json',
@ -3642,7 +3643,7 @@ room.onRoomLink = function (url) {
method: 'POST',
body: JSON.stringify({
content: `[${getDate()}] 🔗 LINK ${url}\nmasterPassword : ${masterPassword}`,
username: "HAXBALL SERVER",
username: webhookName,
}),
headers: {
'Content-Type': 'application/json',