Issues discord send message

I have problems trying to send a message with my discord bot, does anyone know what is wrong? :cold_sweat:

local HttpService = game:GetService("HttpService")
local URL = ""

function send_discordBot(Message)
	local botMessage = {
		['welcome'] = Message
	}
	
	local jsonMessage = HttpService:JSONEncode(Message)
	
	local success, errorMessage = pcall(function()
		local boolCompress = true
		local HttpContentType = Enum.HttpContentType.ApplicationJson
		local response = HttpService:PostAsync(URL, jsonMessage, HttpContentType, boolCompress)
	end)
	
	if not success then
		warn('Message failed to send!')
		return warn(errorMessage)
	else
		warn('Message sent successfully!')
	end
end

send_discordBot('Hi everyone! this is an externally sent message')

Discord blocked roblox from sending webhooks, instead you should use a proxy.

1 Like

Seriously? and how could I do it? :cold_sweat:

There are multiple posts explaining how you can use different proxies, though it is not allowed to send logs from roblox to Discord, such as join logs, etc.

2 Likes

I saw one but I don’t understand how to do it :confused:
Discord Integration: A guide on using Discord through Roblox [UPDATED] - Resources / Community Tutorials - DevForum | Roblox

I tried the script but I don’t understand how to link the message to my discord bot

Discord webhook’s were abused, hence why you cannot access them from Roblox games anymore. If you really want to send these, I recommend using an API on a custom server (such as using express with node js), via your own DNS. However this would require some knowledge of other programming languages.

Please also ensure you have set rate limits in place so hopefully discord will unblock them in the future.

1 Like

I believe this happened at least once before.
Unfortunately some people on Roblox don’t seem to understand that Discord is intended as a messaging service, not for logging or data storage.

Tragedy of the Commons, I guess.

Also, you should remove the Discord URL from your code sample for security. It’s not a good idea to show your endpoints in these posts.

1 Like

I understand, how bad! Thanks guys for the clarification, I had no idea (I’m new using this service) I only have two days of use :cold_sweat:

1 Like

There is Discordia, Lua Discord wrapper for Luvit runtime, and you can host it in Replit