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

How do I use the discord webhook to send a direct message to the player?

Asked by 2 years ago

here is the code i've made:

local webhook = 'webhook here'
local HS = game:GetService('HttpService')

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
    local randomskinnum = math.random(math.random(1,5), math.random(5,10))
    print(randomskinnum)
    local message = {
        ['content'] = player.Name.. ' got a number of '.. randomskinnum
    }
    local msg = HS:JSONEncode(message)
    HS:PostAsync(webhook, msg)
end)

For now, it can only send messages in a channel but I want to know how I can make it send a direct message to a certain user.

1 answer

Log in to vote
1
Answered by
xXMadonXx 190
2 years ago

You send the Roblox user Name or user id over the Webhook.

Everything else is handled by the Discord Bot script and not for subject in this forum. You basically need Discord users to verify themselves with their roblox account and create a database to link discord id to roblox player name or player id.

Ad

Answer this question