mcsleepingserverstarter
mcsleepingserverstarter copied to clipboard
Be able to edit Discord webhook message
Hello, I would like to be able to edit the webhook message in the settings instead to have to edit the whole code. Here what I edited to be exactly to my liking on "sleepingDiscord.ts":
onPlayerLogging = async (playerName: string) => {
const content = `{
"content": null,
"embeds": [
{
"description": "${playerName} a réveillé le serveur Minecraft, démarrage en cours...",
"color": 65280
}
],
"username": "Minecraft"
}`;
await this.sendMessage(content, true);
}
onServerStop = async () => {
const content = `{
"content": null,
"embeds": [
{
"description": "Le serveur est vide, arrêt en cours...",
"color": 16711680
}
],
"username": "Minecraft"
}`;
await this.sendMessage(content, false);
}
}
The avatar is already defined on the webhook settings inside of Discord, same for the username but I edited here to not break the code.
I changed the color, and instead of "title" I used "description" because I don't want the message to be bold.
I'm using a plugin to send message when the server is started, here the result:
Translation:
- Player waked-up the server, starting...
- Server started
I did the same for shutting down the server, but it's doing doublons so I want to be able to disable onServerStop, I tried to remove the code block but npm start won't start saying onServerStop is missing. I hope you see the idea what we should be able to edit directly in "sleepingSettings.yml".
Thank you!
hey! thanks for the issue that's actually a nice idea, i'm gonna work on that this week 😉
Hello, I just noticed something:
If it's a bedrock client who is waking up the server, it does not say the nickname, just "A Bedrock Player", it's completely defeating the webhook feature, is it possible to know what bedrock player like on java? (I'm using geyser so I have bedrock players and java players.
On se base sur une librairie externe pour BedRock et le développement n'est pas encore aussi avancé que la librairie java https://www.npmjs.com/package/@jsprismarine/prismarine
Si une màj sort, on alignera le fonctionnement. :-)
I haven't used typescript before, but I hope you can add a way to send a message when the server is listening for users to join. I know its not quite related to this issue but that would actually be awesome.
Hello, I would like to be able to edit the webhook message in the settings instead to have to edit the whole code. Here what I edited to be exactly to my liking on "sleepingDiscord.ts":
onPlayerLogging = async (playerName: string) => { const content = `{ "content": null, "embeds": [ { "description": "${playerName} a réveillé le serveur Minecraft, démarrage en cours...", "color": 65280 } ], "username": "Minecraft" }`; await this.sendMessage(content, true); } onServerStop = async () => { const content = `{ "content": null, "embeds": [ { "description": "Le serveur est vide, arrêt en cours...", "color": 16711680 } ], "username": "Minecraft" }`; await this.sendMessage(content, false); } }
The avatar is already defined on the webhook settings inside of Discord, same for the username but I edited here to not break the code. I changed the color, and instead of "title" I used "description" because I don't want the message to be bold. I'm using a plugin to send message when the server is started, here the result:
Translation:
* Player waked-up the server, starting... * Server started
I did the same for shutting down the server, but it's doing doublons so I want to be able to disable onServerStop, I tried to remove the code block but npm start won't start saying onServerStop is missing. I hope you see the idea what we should be able to edit directly in "sleepingSettings.yml".
Thank you!
@vincss Hi there I'm sorry if this is the wrong place to do this kind of stuff, I'm new to github and still learning how stuff works would it be okay if I tried to make this feature a thing? if you want you can just add me on discord to discuss everything there instead of here to not spam the issue (my tag is Rėi#0090)