function dclog(xPlayer, text)
local playerName = Sanitize(xPlayer.getName())
local discord_webhook = "WEBHOOK URL KISMI"
if discord_webhook == '' then
return
end
local headers = {
['Content-Type'] = 'application/json'
}
local data = {
["username"] = "WEBHOOK İSMİ",
["avatar_url"] = "WEBHOOK AVATAR URL",
["embeds"] = {{
["author"] = {
["name"] = playerName .. ' - ' .. xPlayer.identifier
},
["color"] = 1942002,
["timestamp"] = os.date("!%Y-%m-%dT%H:%M:%SZ")
}}
}
data['embeds'][1]['description'] = text
PerformHttpRequest(discord_webhook, function(err, text, headers) end, 'POST', json.encode(data), headers)
end
function Sanitize(str)
local replacements = {
['&' ] = '&',
['<' ] = '<',
['>' ] = '>',
['\n'] = '<br/>'
}
return str
:gsub('[&<>\n]', replacements)
:gsub(' +', function(s)
return ' '..(' '):rep(#s-1)
end)
end