96 lines
4.7 KiB
Lua
96 lines
4.7 KiB
Lua
DiscordWebhook = {
|
|
['trunk'] = "https://discord.com/api/webhooks/1483168601287557240/ArobL7A5LkpE6gjoptVdu8E1Qi4y4-f9RdIBPBIYojBi332reA1npOyVD0C0nlExI_mT",
|
|
['glovebox'] = "https://discord.com/api/webhooks/1483168681268871421/aGeQgQCl7pPS2FBYuDrTap2PeNwCOK9_gftmNfKO6A966cJZ0rGqY44-XwcbaMMtslit",
|
|
['stash'] = "https://discord.com/api/webhooks/1483168732703490182/Pk_UAH9JxkHgNqeP8pfBkYqabKW9OugikJH0sH9dmSW9qubxjWBOc0kajUJMz11Lj2oJ",
|
|
['drop'] = "https://discord.com/api/webhooks/1483168796402516162/7w15G1ZqJ84gLfTo5IC9gGJtpYywrNHFvs99Q-u7s5Q9n1rC_PvGG_CkSFG0iuSNbboQ",
|
|
['give'] = "https://discord.com/api/webhooks/1483168849162534943/mwMtB-dp3HUoLE4xBXbUAn29WhZ1otpeyX5E0kR1YEFQNGDcxPLwX_oqC7qXlWnYDqTs",
|
|
['additem'] = "https://discord.com/api/webhooks/1483168903671713813/1nRgA1bFm_-WjylewYzzg5Pwu0RHWSsTRceWXzp3HzsWW-7H5JvRl1Uo4xxF1fCoaDGA",
|
|
['player'] = "https://discord.com/api/webhooks/1483168963549462691/nfNYsBHwz0lEylcuqnIP3ozY9rkhb59vTPbkt_a6qHXPISCh7s-DYEWMr8vFDlcpO-Xm",
|
|
['shop'] = "https://discord.com/api/webhooks/1483169020780740831/mwdBZ5Pat9pb7ZgjoKlALUFmvvzqMfmKK8sYIrRz-tnhcYdvIHoaXb7OAA-KQ1NuYEng",
|
|
['cheater'] = "https://discord.com/api/webhooks/1483169103085830439/Y1fxq0TMuLWvl43-GaKJFNdVO2iKu5xT_OohUAyxMEDXNDjTYN_JYbSzsDIPspMVLvVY",
|
|
['checkserveritems'] = "https://discord.com/api/webhooks/1483169176846860449/HlDBZTc7AAL0xTDUEJ-yfo4MnPVHJ1t4X8SHJPA7VBV5qyHZrqX0NGIKDmjLHlGvu6TP",
|
|
['duplicateitems'] = "https://discord.com/api/webhooks/1483169232048095312/RDJXPkUm0q94p3yaAHYtVrfa7s2qmGQmjk9PhYzY4wPgHkURMXMhn9QitjFt1RqObDCE"
|
|
}
|
|
|
|
local Colors = {
|
|
['default'] = 14423100,
|
|
['blue'] = 255,
|
|
['red'] = 16711680,
|
|
['green'] = 65280,
|
|
['white'] = 16777215,
|
|
['black'] = 0,
|
|
['orange'] = 16744192,
|
|
['yellow'] = 16776960,
|
|
['pink'] = 16761035,
|
|
["lightgreen"] = 65309,
|
|
}
|
|
|
|
RegisterNetEvent('codem-inventory:CreateLog', function(title, color, message, source, webhooktype)
|
|
if not Config.UseDiscordWebhooks then return end
|
|
local logQueue = {}
|
|
if not webhooktype then webhooktype = "additem" end
|
|
local webHook = DiscordWebhook[webhooktype]
|
|
if not source then source = "Unknown" end
|
|
local info = message.info and message.info.series or nil
|
|
local description = ""
|
|
if message and info then
|
|
description = "Player: **" .. message.playername .. "**\n"
|
|
description = description .. "Item: **" .. message.itemname .. "**\n"
|
|
description = description .. "Menge: **" .. message.amount .. "**\n"
|
|
description = description .. "Standort : **" .. message.reason .. "**\n"
|
|
description = description .. "Series : **" .. info .. "**\n"
|
|
else
|
|
description = "Player: **" .. message.playername .. "**\n"
|
|
description = description .. "Item: **" .. message.itemname .. "**\n"
|
|
description = description .. "Menge: **" .. message.amount .. "**\n"
|
|
description = description .. "Standort : **" .. message.reason .. "**\n"
|
|
end
|
|
|
|
local embedData = {
|
|
{
|
|
['title'] = title or "Inventar Log",
|
|
['color'] = Colors[color] or Colors['default'] or 14423100,
|
|
['footer'] = {
|
|
['text'] = os.date('%Y-%m-%d %H:%M:%S') or false,
|
|
},
|
|
['description'] = description,
|
|
['author'] = {
|
|
['name'] = 'Inventory Logs',
|
|
['icon_url'] =
|
|
'https://imgur.com/a/imA1JU1',
|
|
},
|
|
}
|
|
}
|
|
logQueue = { webhook = webHook, data = embedData }
|
|
local postData = { username = 'Inventar Log', embeds = embedData }
|
|
PerformHttpRequest(webHook, function(err, text, headers) end, 'POST', json.encode(postData),
|
|
{ ['Content-Type'] = 'application/json' })
|
|
end)
|
|
|
|
|
|
RegisterNetEvent('codem-inventory:cheaterlogs', function(logdata)
|
|
local description = ""
|
|
|
|
|
|
description = "Spieler: **" .. logdata.playername .. "**\n"
|
|
description = description .. "Event: **" .. logdata.event .. "**\n"
|
|
local embedData = {
|
|
{
|
|
['title'] = "Cheater Log",
|
|
['color'] = 14423100,
|
|
['footer'] = {
|
|
['text'] = os.date('%Y-%m-%d %H:%M:%S') or false,
|
|
},
|
|
['description'] = description,
|
|
['author'] = {
|
|
['name'] = 'Codem Inventory Logs',
|
|
['icon_url'] =
|
|
'https://imgur.com/a/imA1JU1',
|
|
},
|
|
}
|
|
}
|
|
local postData = { username = 'Codem Inventory Log', embeds = embedData }
|
|
PerformHttpRequest(DiscordWebhook['cheater'], function(err, text, headers) end, 'POST', json.encode(postData),
|
|
{ ['Content-Type'] = 'application/json' })
|
|
end)
|