Discord Webhook Module

I just created a post about Roblox - Discord webhooks and it’s in approval :rofl:

But yours is way better than mine :smiley:

I would definitely use yours instead of mine :smirk:

Anyways, thanks for sharing this with the community! :partying_face:

2 Likes

Provided that the message being sent includes its own __tostring metamethod you should be able to add messages directly the PostHandler.

This is so that it can be integrated into existing system without the need to rewrite large amounts of code.

1 Like

Using Discord-Roblox webhooks can be quite dangerous, depending on what you send using those webhooks. I strongly recomend using a discord bot as discord do not really like you sending too much data or information to them, if you do use this in a abusive way you can get your server deleted and possibly your account.

1 Like

All imputs are checked so that messages, embeds and field conform to API limits. If there are any checks missing please let me know and I will update the module accordingly.

Now that webhooks can essentially escape @ (see AllowedMention object) I feel that there are safer than before. All content posted under the http service should be scrutinize regardless of the endpoint being used.

The goal of this module is to conform to API specs.

1 Like

The webhooks aren’t sending for me, (nothing happens and I’m pretty sure the format is correct), any idea why?

Oh hey I know this guy. Well done KD :slight_smile:

Here is this webhook in a live game sending sales logs to our server.

3 Likes

The def error handler will print out faild messages. Double check that api credentials and that you have enabled http calls in your game.

1 Like

Thank you, I have bookmarked this page as I will be sure to use this

The test script is for debugging/testing and used as a general example. It is disabled by default and requires your webhook credentials to run.

I am unsure why you are running this test script in “pending-applications”. I would use a test channel then change the webhook credentials afte you have the message in the format you desire.

I’ve really been enjoying this webhook and generally it’s very nice to use. But I have an issue with mentioning specific roles. Here is a snippet of what I am using… do you think you can help?

local Message = Webhook:NewMessage()
local Mentions = Message:GetAllowedMention()

Mentions:AddGlobalMention("roles")
--Mentions:AddRoleId(774417755259928577) --No matter whether I use this or the add global mention, they both don't work
Message:Append("@On Duty")

Message:Send()

Go into your discord and type in @On Duty and then before the @ put a , press enter then make sure your Append is what you just sent.

That’s not correct. The solution is “<@roleidhere>”. Mentioning roles is the same as mentioning a user, it requires the ID.

1 Like

There is two ways you can mention the role then put \ before you click enter and it sends the same result.

1 Like

That’s…not how discord works? You do realize the mechanics behind mentioning isn’t the same as sending text right?

1 Like

No, you just use <@&[ROLE-ID]>

![https://gyazo.com/31ea4e724c35316213db2d7a01a6bb21.gif]

![https://gyazo.com/31ea4e724c35316213db2d7a01a6bb21.gif]

Yes, that is what happens internally, the ping actually uses the ID. What is your point?

I can’t figure it out where do I find the credentials?

See test script but due to the player thumbnail endpoint changes the code may need to be altered.