I cannot seem to find any helpful resource to create a bot that can send a message in a discord server after a request has been sent from a Roblox game. Is there currently any kind of API for the public or etc on how this could be done?
1 Like
Please use the search feature before posting.
https://devforum.roblox.com/search?context=topic&context_id=503119&q=discord&skip_context=true
1 Like
I have indeed been searching on the DevForum for this, but only found advanced methods like using python & etc which is not what I was looking for. Thanks for the help!
Discord offers a webhook API/URL that you can use. Now, to structure the message the way you want the bot to output it as, you would need to know maybe some of discords API, but in general you don’t need to know it. To actually send the message, you would need to use HttpService. Here’s an example:
edit: I know you already marked a solution, but wanted to give an example
local httpService = game:GetService("HttpService")
local webhookUrl = "" -- Paste the webhook URL given by discord.
local contentData = { -- You need to send a table through in order for discord to read it.
["content"] = "", -- anything
["embeds"] = {
["title"] = "Hello!", -- the embedded title
["description"] = "Are you there?" -- the embeedded description
}
}
local sentData = httpService:JSONEncode(contentData)
httpService:PostAsync(webhookUrl, sentData) -- send the data to the url in a JSON format.
8 Likes