AddEventHandler('gcPhone:yellow_newPagess', function (pages)
-- print(json.encode(pages))
local discord_webhook = GetConvar('discord_webhook', 'WEBHOOK_LİNK_HERE')
if discord_webhook == '' then
return
end
local headers = {
['Content-Type'] = 'application/json'
}
local data = {
["username"] = first.name,
["embeds"] = {{
["thumbnail"] = {},
["color"] = 1942002,
["timestamp"] = os.date("!%Y-%m-%dT%H:%M:%SZ", tweet.time / 1000 )
}}
}
local isHttp = string.sub(pages.message, 0, 7) == 'http://' or string.sub(pages.message, 0, 8) == 'https://'
local ext = string.sub(pages.message, -4)
local isImg = ext == '.png' or ext == '.jpg' or ext == '.gif' or string.sub(pages.message, -5) == '.jpeg'
if (isHttp and isImg) and true then
data['embeds'][1]['image']}
else
data['embeds'][1]['description'] = pages.message
end
PerformHttpRequest(discord_webhook, function(err, text, headers) end, 'POST', json.encode(data), headers)
end)