Categories > Coding > Lua >

Send a message to a discord webhook script

Posts: 207

Threads: 9

Joined: Feb, 2023

Reputation: 5

Posted

A simple script that send a message to a discord webhook.

Hoped it helped you guys c:

 

Note:

Works on all exploits that support the request() function. If you use Synapse you need to modify the code to use syn.request instead of request, Read the synapse docs if you don't know how to modify.

function SendMessage(url, message)
    local http = game:GetService("HttpService")
    local headers = {
        ["Content-Type"] = "application/json"
    }
    local data = {
        ["content"] = message
    }
    local body = http:JSONEncode(data)
    local response = request({
        Url = url,
        Method = "POST",
        Headers = headers,
        Body = body
    })
    print("Sent")
end

function SendMessageEMBED(url, embed)
    local http = game:GetService("HttpService")
    local headers = {
        ["Content-Type"] = "application/json"
    }
    local data = {
        ["embeds"] = {
            {
                ["title"] = embed.title,
                ["description"] = embed.description,
                ["color"] = embed.color,
                ["fields"] = embed.fields,
                ["footer"] = {
                    ["text"] = embed.footer.text
                }
            }
        }
    }
    local body = http:JSONEncode(data)
    local response = request({
        Url = url,
        Method = "POST",
        Headers = headers,
        Body = body
    })
    print("Sent")
end


--Examples 
local url = ""
SendMessage(url, "Hello")


local embed = {
    ["title"] = "This is an embedded message",
    ["description"] = "This message has an embed with fields and a footer",
    ["color"] = 65280,
    ["fields"] = {
        {
            ["name"] = "Field 1",
            ["value"] = "This is the first field"
        },
        {
            ["name"] = "Field 2",
            ["value"] = "This is the second field"
        }
    },
    ["footer"] = {
        ["text"] = "This is the footer text"
    }
}
SendMessageEMBED(url, embed)

  • 1

Added

@bennytrt,

 

Thanks Bro :sunglasses:

  • 0

https://media.discordapp.net/attachments/1134643100715855893/1138795549244539011/SiggyOnGod.png

Murz

PixelPenguin

Posts: 240

Threads: 20

Joined: Jul, 2021

Reputation: 29

Replied

Very good, however it has security flaws as every roblox script does that includes webhooks on the client side.

 

I would recommend actually sending messages through an external server that you own.

 

I recommend maybe writing something quickly in php (if you do not know it that is fine! just giving some tips for the future if you didn't know,) that can essentially do the same thing. It will take up less lines if done correctly, while also being more secure, and you can even include a filter to prevent spam!

 

Albeit, this was a great project that you have made. I didn't even think it was possible in Roblox using the HttpGet service as when I tried one time in development for a Roblox game it failed. Keep up the great work!

  • 0

 

Ty for rep: Swiney, Byoke, Lion, Locust, Waves, Weeb, Nickk, darkn, Atari, CubeFaces, Lux14, Rice, Delta, Syraxes, Aeon, Jordan, Pluto, and Hiroku!

P.S, I like cats better too!

Posts: 207

Threads: 9

Joined: Feb, 2023

Reputation: 5

Replied

@Murz, Thanks for your tips and feedback, I'm glad you liked it :)

  • 1

Added

@RealNickk, Ooh, thanks for the idea lmfao

  • 1

https://media.discordapp.net/attachments/1134643100715855893/1138795549244539011/SiggyOnGod.png

Cyros

Revision

Posts: 1060

Threads: 49

Joined: Feb, 2021

Reputation: 20

Replied

@Aetheron, this is really cool but however you should do stuff like this via PHP or Node.JS with some stuff in Lua (like sending the request but not showing the JSON on the client side)

but this is really good for a point and i'd probably do something similar like this :D
seems like you did some effort in this script which I think is good for you and other people can learn off of you if you keep on doing this!

i realised you noted this in your thread but do this since it makes it support all exploits:

local RequestFunction = (syn and syn.request) or request or http.request or http_request

RequestFunction({
    -- add your request here that supports both UNC and Synapse X Standards
})

This allows support for Synapse X as it doesn't support UNC (exploits that uses UNC for their exploit will use request, http.request or http_request)

  • 0

We Hate VOID

Posts: 207

Threads: 9

Joined: Feb, 2023

Reputation: 5

Replied

@atariXD, I understand but I don't know PHP much, I'm willing to learn though.

  • 0

https://media.discordapp.net/attachments/1134643100715855893/1138795549244539011/SiggyOnGod.png

Posts: 1430

Threads: 71

Joined: May, 2022

Reputation: 20

Replied

@Murz you lost me at "external server"

  • 0

i use arch btw

Murz

PixelPenguin

Posts: 240

Threads: 20

Joined: Jul, 2021

Reputation: 29

Replied

@Whoman,

 

I am sorry... Also hi Whoman, I remember you from a while ago! I used to see you active a lot more but not as much recently. I am glad to see you still actually sometimes visit the site! How have you been, my friend?

  • 0

 

Ty for rep: Swiney, Byoke, Lion, Locust, Waves, Weeb, Nickk, darkn, Atari, CubeFaces, Lux14, Rice, Delta, Syraxes, Aeon, Jordan, Pluto, and Hiroku!

P.S, I like cats better too!

Posts: 1430

Threads: 71

Joined: May, 2022

Reputation: 20

Replied

@Murz yeah there just hasnt been that much on wrd, just "rate this ui" with the most basic ui ever and "omg jjsploit no work im literally gonna die" or crazy code that i dont understand 

  • 0

i use arch btw

Murz

PixelPenguin

Posts: 240

Threads: 20

Joined: Jul, 2021

Reputation: 29

Replied

@Whoman,

 

fair enough, that is true.

  • 0

 

Ty for rep: Swiney, Byoke, Lion, Locust, Waves, Weeb, Nickk, darkn, Atari, CubeFaces, Lux14, Rice, Delta, Syraxes, Aeon, Jordan, Pluto, and Hiroku!

P.S, I like cats better too!

yvneEnvy

<><><<>>><<>

Posts: 306

Threads: 47

Joined: Mar, 2023

Reputation: 3

Replied

Uhh cool, vouch

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )