Is there any way that I can send a message to discord? [SOLVED]

Like once the player join it will be send in discord

2 Likes

There are tons of tutorials on how to do that.

1 Like

There is a tutorial video on it

3 Likes

IDK why it’s not working in game but in roblox studio its working

In order to send a message to Discord from Roblox, you will need to use HTTP-Service. HTTPService lets you communicate with API’s/etc, across the web.

In this case, since you are sending a message to a webhook, you will need to use the method POST.
Then, convert the lua table into a JSON table (data); which will be in the 2nd argument of the POST method.

Here is how you will send just a message:

local HTTPService = game:GetService("HttpService")
local proxy = "https://hooks.hyra.io"
local hook = ""
hook = string.gsub(hook, "https://discord.com", proxy)

local d = HTTPService:JSONEncode({
	["content"] = "hey!"
})

HTTPService:PostAsync(hook, d)

Although, there is other table types you can use, such as embeds:

['embeds'] = {{
			["image"] = {["url"] = image},
			['title'] = "**"..title.."**",
			['description'] = message,
			['type'] = "rich",
			["color"] = tonumber(0xffffff),
			['fields'] = fields
                  }
		},

REMINDER: Discord banned Roblox from sending webhooks from the normal URL.

(it will only send the webhook from roblox studio, but not in server.)

To fix this, you will need to use a proxy (does not violate TOS), one good one is Hyra (hooks)

7 Likes

So you mean I won’t getting banned by using hyra and the hook is the webhook url right?

Hyra is a proxy, it goes through the Discord Webhook ban; and let’s you send a webhook in server and studio. This does NOT violate Discord TOS. It abides it by having a rate limiter (aka enforcing the discord webhooks guidelines). All you need to do is replace “https://discord.com” with: “https://hooks.hyra.io”, although I did make your life easier by replacing “https://discord.com” with “https://hooks.hyra.io” with gsub.

TL;DR

Nope, you won’t get banned, you just replace the first characters of the webhook URL with the proxy URL.

Thanks it will help me a lot because I’m making a custom admin and I want if the player use any admin commands it will log

No problem!

Just note that this proxy (going to all the other ones aswell); has to follow the discord TOS; enforcing the rate limits, and rejecting requests that exceed it.

So if someone is spamming commands or so a bunch of times; and spamming/sending multiple post requests through the webhook, it will stop any other requests for a few seconds, before allowing any more.

No problem my game avarage people on game is 50-60 peoples only and I will make a command cooldown

1 Like