-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_discordlog.lua
More file actions
58 lines (52 loc) · 2.23 KB
/
server_discordlog.lua
File metadata and controls
58 lines (52 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
-- Insert you Discord Webhook here
local webhookLink = ""
function sendDiscordLog(xPlayer, action, method, amount, item)
if Config.DiscordLog then
if action == 'buy' then
action = 'bought'
elseif action == 'sell' then
action = 'sold'
end
local botColor = Config.botColor
local botName = Config.botName
local botAvatar = Config.botAvatar
local title = "MSK Shops"
local description = xPlayer.name .. " (ID: " .. xPlayer.source .. ") " .. action .. " " .. amount .. "x " .. item.label .. " (" .. item.name .. ")"
local fields = {
{name = "Name", value = xPlayer.name .. " (ID: " .. xPlayer.source .. ")", inline = true},
{name = "Method", value = method, inline = true},
{name = "Action", value = action, inline = false},
{name = "Amount", value = amount, inline = true},
{name = "Item", value = item.label .. " (" .. item.name .. ")", inline = true}
}
local footer = {
text = "© MSK Scripts",
link = "https://i.imgur.com/PizJGsh.png"
}
local time = "%d/%m/%Y %H:%M:%S" -- format: "day/month/year hour:minute:second"
addDiscordLog(webhookLink, botColor, botName, botAvatar, title, description, fields, footer, time)
end
end
function sendDiscordLogLicense(xPlayer, method, license)
if Config.DiscordLog then
local botColor = Config.botColor
local botName = Config.botName
local botAvatar = Config.botAvatar
local title = "MSK Shops"
local description = xPlayer.name .. " (ID: " .. xPlayer.source .. ") bought the license " .. license.label .. " (" .. license.name .. ")"
local fields = {
{name = "Name", value = xPlayer.name .. " (ID: " .. xPlayer.source .. ")", inline = true},
{name = "Method", value = method, inline = true},
{name = "License", value = license.label .. " (" .. license.name .. ")"}
}
local footer = {
text = "© MSK Scripts",
link = "https://i.imgur.com/PizJGsh.png"
}
local time = "%d/%m/%Y %H:%M:%S" -- format: "day/month/year hour:minute:second"
addDiscordLog(webhookLink, botColor, botName, botAvatar, title, description, fields, footer, time)
end
end
addDiscordLog = function(webhook, botColor, botName, botAvatar, title, description, fields, footer, time)
MSK.AddWebhook(webhook, botColor, botName, botAvatar, title, description, fields, footer, time)
end