Discord webhook events?

Back with Discord Webhooks. I use discord webhooks for data messages and report at the channel instead of Console Logs. Is it possible to make events like:

  • Reacted with a certain reaction to trigger an event
  • When deleted, it triggers an event
1 Like

If you want something to happen in game when a message in your server gets a reaction/deleted, then it isn’t possible without a custom bot. You would have to combine it with request polling which probably isn’t the best idea. You wouldn’t want all of your game’s servers spamming requests to your endpoint, would you?

On a side note, you shouldn’t use webhooks to log events in your game. Imagine your data messages log script running in 100 servers at once, spamming your webhook out of it.

3 Likes

I’m fairly new with the discord bot customization. I just struggle on how you link it on Roblox if possible.

1 Like

There are two ways to do that.

1 - Using your own custom endpoint

The idea is simple: write a discord bot with a lib such as discord.js, and set up a webhost and an endpoint with express.js (let’s call the endpoint /getmsgs). The endpoint would grab all messages from your desired channel, and return them (along with their reactions) as a JSON array.

Then your script in game would make a request to /getmsgs every few seconds, and compare the return of it with the stored cache. If it noticed a difference, such as a message missing (deleted), or a new reaction on one, it would do something you want.

2 - Using discord’s api directly

This is much like the 1st idea except you don’t set up a script for the bot nor a webhost. You just need the bot in your server and the bot’s token. From that point just make requests to discord’s fetch messages api with the token set as the Authorization header.

2 Likes

You’ll have to set up your own web server a language of your choice. This will allow you to create API’s you can send requests to that perform certain tasks with the data they are given (and can be configured to return data in the response).

Here’s a tutorial on Discord bots.

Here’s a tutorial on setting up a webserver. (and more)

3 Likes

What you’re asking for (using a channel webhook as a place to store logs) is against the rules of Discord, and which is why we initially got blocked in the first place.

https://twitter.com/lolpython/status/967211473586987009

Do not do this. Your webhook will be banned and you may do a part in getting us blocked again.

5 Likes

Correct me if I’m wrong, but using webhooks for roblox logs itself wasn’t the reason for the user-agent ban, but rather (as the tweet says) the fact that 88% of those requests were malformed (and received 400 bad request error).

1 Like

You’re wrong.

If you’re logging all outputs, that’s even worse than error logging.

2 Likes

Oh, ok. I didn’t know about this issue with Discord APIs. I’m still hoping to find a way to store logs in place than discord.

1 Like