Skip to content

Commit a2c756f

Browse files
Adds "SendDiscordEmbed(tEmbed" (#2)
Example: ```lua local myEmbed = { ["title"] = "Test example", ["description"] = "Description example", ["color"] = 16711680 } SendDiscordEmbed(myEmbed) ```
1 parent dd3262a commit a2c756f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Server/Index.lua

+10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ function SendDiscordMessage(message)
2020
)
2121
end
2222

23+
-- Send Embed Message method
24+
function SendDiscordEmbed(tEmbed)
25+
HTTP.Request(
26+
"https://discord.com",
27+
"/api/webhooks/" .. DISCORD_WEBOOK_ID .. "/" .. DISCORD_WEBOOK_TOKEN,
28+
"POST",
29+
'{"embeds":[' .. JSON.stringify(tEmbed) .. '], "allowed_mentions":{"parse":[]}}'
30+
)
31+
end
32+
2333
-- Events intercept to print on Discord
2434
Server.Subscribe("Chat", function(text, player)
2535
SendDiscordMessage("**" .. player:GetName() .. "**: " .. text)

0 commit comments

Comments
 (0)