Skip to content

Commit

Permalink
refactor: use server config for webhook urls
Browse files Browse the repository at this point in the history
  • Loading branch information
solareon committed Dec 7, 2023
1 parent f8dfdd2 commit 4bd8a65
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion server/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ lib.callback.register('qbx_core:server:loadCharacter', function(source, citizenI
SetPlayerRoutingBucket(source, 0)
logger.log({
source = GetInvokingResource(),
webhook = 'joinleave',
webhook = config.logging.webhook['joinleave'],
event = 'Loaded',
color = 'green',
message = '**'.. GetPlayerName(source) .. '** ('..(GetPlayerIdentifierByType(source, 'discord') or 'undefined') ..' | ||' ..(GetPlayerIdentifierByType(source, 'ip') or 'undefined') .. '|| | ' ..(GetPlayerIdentifierByType(source, 'license2') or GetPlayerIdentifierByType(source, 'license') or 'undefined') ..' | ' ..citizenId..' | '..source..') loaded..'
Expand Down
3 changes: 2 additions & 1 deletion server/events.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local serverConfig = require 'config.server'.server
local loggingConfig = require 'config.server'.logging
local logger = require 'modules.logger'

-- Event Handler
Expand Down Expand Up @@ -36,7 +37,7 @@ AddEventHandler('playerDropped', function(reason)
local player = QBX.Players[src]
logger.log({
source = GetInvokingResource(),
webhook = 'joinleave',
webhook = loggingConfig.webhook['joinleave'],
event = 'Dropped',
color = 'red',
message = '**' .. GetPlayerName(src) .. '** (' .. player.PlayerData.license .. ') left..' ..'\n **Reason:** ' .. reason,
Expand Down
2 changes: 1 addition & 1 deletion server/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ local function ExploitBan(playerId, origin)
DropPlayer(playerId --[[@as string]], Lang:t('info.exploit_banned', {discord = serverConfig.discord}))
logger.log({
source = GetInvokingResource(),
webhook = 'anticheat',
webhook = loggingConfig.webhook['anticheat'],
event = 'Anti-Cheat',
color = 'red',
tags = loggingConfig.role,
Expand Down
14 changes: 7 additions & 7 deletions server/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function LoginV2(source, citizenid, newData)
DropPlayer(tostring(source), Lang:t("info.exploit_dropped"))
logger.log({
source = GetInvokingResource(),
webhook = 'anticheat',
webhook = config.logging.webhook['anticheat'],
event = 'Anti-Cheat',
color = 'white',
tags = config.logging.role,
Expand Down Expand Up @@ -356,7 +356,7 @@ function CreatePlayer(playerData, Offline)
local tags = amount > 100000 and config.logging.role or nil
logger.log({
source = GetInvokingResource(),
webhook = 'playermoney',
webhook = config.logging.webhook['playermoney'],
event = 'AddMoney',
color = 'lightgreen',
tags = tags,
Expand Down Expand Up @@ -393,7 +393,7 @@ function CreatePlayer(playerData, Offline)
local tags = amount > 100000 and config.logging.role or nil
logger.log({
source = GetInvokingResource(),
webhook = 'playermoney',
webhook = config.logging.webhook['playermoney'],
event = 'RemoveMoney',
color = 'red',
tags = tags,
Expand Down Expand Up @@ -426,7 +426,7 @@ function CreatePlayer(playerData, Offline)
self.Functions.UpdatePlayerData()
logger.log({
source = GetInvokingResource(),
webhook = 'playermoney',
webhook = config.logging.webhook['playermoney'],
event = 'SetMoney',
color = 'green',
message = '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** $' .. amount .. ' (' .. moneytype .. ') set, new ' .. moneytype .. ' balance: ' .. self.PlayerData.money[moneytype] .. ' reason: ' .. reason,
Expand Down Expand Up @@ -542,7 +542,7 @@ function DeleteCharacter(source, citizenid)
if success then
logger.log({
source = GetInvokingResource(),
webhook = 'joinleave',
webhook = config.logging.webhook['joinleave'],
event = 'Character Deleted',
color = 'red',
message = '**' .. GetPlayerName(source) .. '** ' .. license2 .. ' deleted **' .. citizenid .. '**..'
Expand All @@ -553,7 +553,7 @@ function DeleteCharacter(source, citizenid)
DropPlayer(tostring(source), Lang:t("info.exploit_dropped"))
logger.log({
source = GetInvokingResource(),
webhook = 'anticheat',
webhook = config.logging.webhook['anticheat'],
event = 'Anti-Cheat',
color = 'white',
tags = config.logging.role,
Expand All @@ -576,7 +576,7 @@ function ForceDeleteCharacter(citizenid)
if success then
logger.log({
source = GetInvokingResource(),
webhook = 'joinleave',
webhook = config.logging.webhook['joinleave'],
event = 'Character Force Deleted',
color = 'red',
message = 'Character **' .. citizenid .. '** got deleted'
Expand Down

0 comments on commit 4bd8a65

Please sign in to comment.