anirudh851
(MasterOfCFrames)
July 23, 2021, 11:22am
1
Before you flag this as duplicate and go, I wanted to tell you that I have used LITERALLY EVERYTHING I could find to send an image inside an embed.
Hey guys,
Today am scripting a discord webhook for the first time, and well am running into problems while trying to send an image to the embed. Here’s my code:
local HTTP = game:GetService("HttpService")
game.Players.PlayerAdded:Connect(function(player)
local data = {
["embeds"] = {{
["avatar_url"] = {url = tostring(game.Players:GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420))},
["description"] = "Player " .. player.Name .. " joined the game!",
["color"] = tonumber(0xFFFAFA),
["fields"] = {
{
["name"] = "Account Age",
["value"] = player.AccountAge.. " days",
["inline"] = true
},
{
["name"] = "User ID",
["value"] = player.UserId,
["inline"] = true
}
}
}},
}
local finaldata = HTTP:JSONEncode(data)
HTTP:PostAsync("https://discord.com/api/webhooks/MyWebhook", finaldata)
end)
Result:
I also tried the “author” method to no avail. Please help me, thanks.
1 Like
inpad_2
(inpad)
July 23, 2021, 12:05pm
2
Not sure if you want to achieve the same, but after a quick search I found this post Sending Images with webhooks - #16 by Luacrative Hope it helps.
1 Like
CAROR567
(CarorDeHauteville)
July 23, 2021, 12:54pm
3
According to the Discord API you can attach an image
and thumbnail
to the embed.
1 Like
acuaro
(acuaro)
July 23, 2021, 1:12pm
4
["thumbnail"] = {["url"] = "https://www.roblox.com/headshot-thumbnail/image?userId=" .. player.UserId .. "&width=150&height=150&format=png"},
Is the correct field (I think) for getting the player’s PFP, you can use this & replace ["avatar_url"]
5 Likes
anirudh851
(MasterOfCFrames)
July 23, 2021, 1:28pm
5
Used that too, no avail. Will check again tho
This won’t solve your question, but it’s worth mentioning something I said the other day which relates to this:
While what @Avanthyst sent might answer your question, keep this in mind: Discord is not a logging service. Do not treat it as such. It’s also worth noting that Discord has blocked Roblox server requests in the past.
Check this post out.
2 Likes
anirudh851
(MasterOfCFrames)
July 23, 2021, 2:26pm
7
Ik that, I was just practicing, i wont dare to use it in a real game lol
2 Likes