Skip to content

Commit c16245f

Browse files
committed
Colors!
-Added color connection -Added color disconnection -Added image when online
1 parent 3389f6f commit c16245f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Serverlogging/server.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local DISCORD_IMAGE = "https://pbs.twimg.com/profile_images/847824193899167744/J
77

88
--DON'T EDIT BELOW THIS
99

10-
PerformHttpRequest(DISCORD_WEBHOOK, function(err, text, headers) end, 'POST', json.encode({username = DISCORD_NAME, content = "**Discord Webhook is ONLINE**"}), { ['Content-Type'] = 'application/json' })
10+
PerformHttpRequest(DISCORD_WEBHOOK, function(err, text, headers) end, 'POST', json.encode({username = DISCORD_NAME, content = "**Discord Webhook is ONLINE**", avatar_url = DISCORD_IMAGE}), { ['Content-Type'] = 'application/json' })
1111

1212
AddEventHandler('chatMessage', function(source, name, message)
1313

@@ -32,12 +32,12 @@ end)
3232

3333
AddEventHandler('playerConnecting', function()
3434
--PerformHttpRequest(DISCORD_WEBHOOK, function(err, text, headers) end, 'POST', json.encode({username = DISCORD_NAME, content = "```CSS\n".. GetPlayerName(source) .. " connecting\n```", avatar_url = DISCORD_IMAGE}), { ['Content-Type'] = 'application/json' })
35-
sendToDiscord("Server Login", GetPlayerName(source) .. " is connecting to the server.")
35+
sendToDiscord("Server Login", GetPlayerName(source) .. " is connecting to the server.", 65280)
3636
end)
3737

3838
AddEventHandler('playerDropped', function(reason)
3939
--PerformHttpRequest(DISCORD_WEBHOOK, function(err, text, headers) end, 'POST', json.encode({username = DISCORD_NAME, content = "```fix\n".. GetPlayerName(source) .. " left ( ".. reason .. " )\n```", avatar_url = DISCORD_IMAGE}), { ['Content-Type'] = 'application/json' })
40-
sendToDiscord("Server Logout", GetPlayerName(source) .. " has disconnected from the server.")
40+
sendToDiscord("Server Logout", GetPlayerName(source) .. " has disconnected from the server.", 16711680)
4141
end)
4242

4343
RegisterServerEvent('playerDied')
@@ -81,10 +81,10 @@ function stringsplit(input, seperator)
8181
return t
8282
end
8383

84-
function sendToDiscord(name, message)
84+
function sendToDiscord(name, message, color)
8585
local connect = {
8686
{
87-
["color"] = "8663711",
87+
["color"] = color,
8888
["title"] = "**".. name .."**",
8989
["description"] = message,
9090
["footer"] = {

0 commit comments

Comments
 (0)