Is there a way I can send a screenshot-basic image to Discord through a webhook. I know it’s definitely possible, but I want to do it through Lua and try to avoid JavaScript if possible.
RegisterNetEvent('Anticheat:ScreenshotSubmit')
AddEventHandler('Anticheat:ScreenshotSubmit', function()
local src = source;
local screenshot = nil;
exports['screenshot-basic']:requestClientScreenshot(src, {
fileName = 'cache/User-' .. tostring(src) .. ".png"
}, function(err, data)
screenshot = data;
if (screenshot ~= nil) then
local embed = {}
local title = "[Possible Hacker] Player `" .. GetPlayerName(src) .. "` has been suspected of using weird keys..."
local message = "";
local footer = "";
embed = {
{
["color"] = 16711680, -- GREEN = 65280 --- RED = 16711680
["title"] = "**".. title .."**",
["description"] = "" .. message .. "",
["footer"] = {
["text"] = footer,
},
["image"] = {['url'] = screenshot}
}
}
PerformHttpRequest(webhookURL,
function(err, text, headers) end, 'POST', json.encode({username = name, embeds = embed}), { ['Content-Type'] = 'application/json' })
end
end)
end)