Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I am trying to get the link to the game a webhook is requested from, but its not working?

Asked by 5 years ago

I am basically trying to create a link to the game where the webhook request is sent from. My current method is this. (Local script)

local CallInfo = script.Parent.Parent.Content.Reason.InputBox.TextBox
local PlaceId = game.PlaceId
local Link = "https://web.roblox.com/games/"
local Violator = script.Parent.Parent.Content.SelectViolator.SelectionBox.SelectionName

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.SGFunction:InvokeServer(
        CallInfo.Text, 
            Link,
                Violator.Text,
                    PlaceId
    )   
end)

(Server script that deals with the webhook)

local webhook = "https://discord.osyr.is/api/webhooks/491046838703751188/8SASOQLlBxykT19ywgGG1eU8sgh5C_Q4dy0pbbJxfeP464bYN1GB13bn6UVhDQUHRJRm"
local http = game:GetService("HttpService")
local WebhookFunction = game.ReplicatedStorage.SGFunction

function WebhookFunction.OnServerInvoke(player, CallInfo, Link, Violator, PlaceId)
    local data = {
                    embeds = {{
                        title = "SG Webhook";
                        description = "Call Recieved";
                        color = 8376188;
                        fields = {
                                    {
                                        name = "User who Called";
                                        value = player.Name
                                    };
                                    {
                                        name = "Violator";
                                        value = Violator
                                    };
                                    {
                                        name = "Call Information";
                                        value = CallInfo
                                    };
                                    {
                                        name = "Game";
                                        value = Link, PlaceId
                                    }

                                }
                            }}
                        }
                        local transmit = http:JSONEncode(data)
                        http:PostAsync(webhook,transmit)
end

As you can see I am trying to take the two locals, Link and PlaceId and put them beside eachother so it creates a full link like this "https://web.roblox.com/games/347401822" so it can be clicked on from inside discord and then take you directly to the game page. I have not been successful so far, so I am wondering if there is a better way to accomplish this.

0
RemoteFunctions are required to return, you may want to switch to a RemoteEvent. User#19524 175 — 5y

Answer this question