How would i go about connecting a bug system to discord?

Ok, so, I’ve Been Making A Game, With a Discord Server For My Group, And I want There to be a ‘Bug Reports’ Section, connected to roblox, so i can see on discord when someone reports a bug.

You’re going to want to make a webhook.

First, make a webhook on your server. Get the webhook URL.
Then, you can use HttpService’s PostAsync or HttpService’s RequestAsync functions to send messages to it.

local httpService = game:GetService("HttpService")
local url = "" --your webhook URL

local function reportBug(player: Player, content: string)
    --get the data for the request
    local requestData = {
        ["Url"] = url,
        ["Method"] = "POST",
        ["Headers"] = {["content-type"] = "application/json"},
        ["Body"] = httpService:JSONEncode({
            ["content"] = content
        })
    }

    local success, result = pcall(httpService.RequestAsync, httpService, requestData)
    if not success then
        warn("Bug report failed;" result)
    end
end

You may also want to filter the message to remove mentions, etc.

local chat = game:GetService("Chat")

--then, within the function...
content = chat:FilterStringForBroadcast(content, player) --filter with chat
content = string.gsub(content, "@[%w_]+", "[user mention removed]") --remove mentions




https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.