Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to edit Discord webhook message #65

Open
Rysanlos opened this issue Nov 17, 2021 · 5 comments
Open

Be able to edit Discord webhook message #65

Rysanlos opened this issue Nov 17, 2021 · 5 comments
Assignees

Comments

@Rysanlos
Copy link

Rysanlos commented Nov 17, 2021

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:
image
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!

@iwa iwa self-assigned this Nov 18, 2021
@iwa
Copy link
Collaborator

iwa commented Nov 18, 2021

hey! thanks for the issue
that's actually a nice idea, i'm gonna work on that this week 😉

@Rysanlos
Copy link
Author

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.
image

@vincss
Copy link
Owner

vincss commented Nov 25, 2021

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. :-)

@ghost
Copy link

ghost commented Dec 9, 2021

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.

@Reishimanfr
Copy link

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: image 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants