Fixed Discord Alerts

This commit is contained in:
Cooldude2606
2020-08-14 03:43:02 +01:00
parent 91d60ba6d7
commit 67c2b8265c

View File

@@ -32,7 +32,7 @@ local function emit_event(args)
end
local tick = args.tick or game.tick
local tick_formatted = format_time(tick, {hours = true, minutes = true, string = true, long = true})
local tick_formatted = format_time(tick, {days = true, hours = true, minutes = true, string = true, long = true})
local players_online = 0
local admins_online = 0
@@ -46,7 +46,7 @@ local function emit_event(args)
local done = {title=true, color=true, description=true}
local fields = {{
name='Server Details',
value=string.format('Server name: ${serverName} Players: %d Admins: %d Time: %s', players_online, admins_online, tick_formatted)
value=string.format('Server: ${serverName} Time: %s\nTotal: %d Online: %d Admins: %d', tick_formatted, #game.players, players_online, admins_online)
}}
for key, value in pairs(args) do
@@ -85,9 +85,9 @@ if config.player_reports then
title='Report',
description='A player was reported',
color=Colors.yellow,
['Player:']='<inline>'..player_name,
['By:']='<inline>'..by_player_name,
['Reason:']=event.reason
['Player']='<inline>'..player_name,
['By']='<inline>'..by_player_name,
['Reason']=event.reason
}
end)
Event.add(Reports.events.on_report_removed, function(event)
@@ -97,9 +97,9 @@ if config.player_reports then
title='Reports Removed',
description='A player has a report removed',
color=Colors.green,
['Player:']='<inline>'..player_name,
['By:']='<inline>'..event.removed_by_name,
['Amount:']='<inline>'..event.batch_count
['Player']='<inline>'..player_name,
['By']='<inline>'..event.removed_by_name,
['Amount']='<inline>'..event.batch_count
}
end)
end
@@ -113,9 +113,9 @@ if config.player_warnings then
title='Warning',
description='A player has been given a warning',
color=Colors.yellow,
['Player:']='<inline>'..player_name,
['By:']='<inline>'..by_player_name,
['Reason:']=event.reason
['Player']='<inline>'..player_name,
['By']='<inline>'..by_player_name,
['Reason']=event.reason
}
end)
Event.add(Warnings.events.on_warning_removed, function(event)
@@ -125,9 +125,9 @@ if config.player_warnings then
title='Warnings Removed',
description='A player has a warning removed',
color=Colors.green,
['Player:']='<inline>'..player_name,
['By:']='<inline>'..event.removed_by_name,
['Amount:']='<inline>'..event.batch_count
['Player']='<inline>'..player_name,
['By']='<inline>'..event.removed_by_name,
['Amount']='<inline>'..event.batch_count
}
end)
end
@@ -141,9 +141,9 @@ if config.player_jail then
title='Jail',
description='A player has been jailed',
color=Colors.yellow,
['Player:']='<inline>'..player_name,
['By:']='<inline>'..by_player_name,
['Reason:']=event.reason
['Player']='<inline>'..player_name,
['By']='<inline>'..by_player_name,
['Reason']=event.reason
}
end)
Event.add(Jail.events.on_player_unjailed, function(event)
@@ -152,8 +152,8 @@ if config.player_jail then
title='Unjail',
description='A player has been unjailed',
color=Colors.green,
['Player:']='<inline>'..player_name,
['By:']='<inline>'..by_player_name
['Player']='<inline>'..player_name,
['By']='<inline>'..by_player_name
}
end)
end
@@ -167,9 +167,9 @@ if config.player_temp_ban then
title='Temp Ban',
description='A player has been temp banned',
color=Colors.red,
['Player:']='<inline>'..player_name,
['By:']='<inline>'..by_player_name,
['Reason:']=event.reason
['Player']='<inline>'..player_name,
['By']='<inline>'..by_player_name,
['Reason']=event.reason
}
end)
Event.add(Jail.events.on_player_untemp_banned, function(event)
@@ -178,8 +178,8 @@ if config.player_temp_ban then
title='Temp Ban Removed',
description='A player has been untemp banned',
color=Colors.green,
['Player:']='<inline>'..player_name,
['By:']='<inline>'..by_player_name
['Player']='<inline>'..player_name,
['By']='<inline>'..by_player_name
}
end)
end
@@ -193,9 +193,9 @@ if config.player_bans then
title='Banned',
description='A player has been banned',
color=Colors.red,
['Player:']='<inline>'..event.player_name,
['By:']='<inline>'..by_player.name,
['Reason:']=event.reason
['Player']='<inline>'..event.player_name,
['By']='<inline>'..by_player.name,
['Reason']=event.reason
}
end
end)
@@ -206,8 +206,8 @@ if config.player_bans then
title='Un-Banned',
description='A player has been un-banned',
color=Colors.green,
['Player:']='<inline>'..event.player_name,
['By:']='<inline>'..by_player.name
['Player']='<inline>'..event.player_name,
['By']='<inline>'..by_player.name
}
end
end)
@@ -221,7 +221,7 @@ if config.player_mutes then
title='Muted',
description='A player has been muted',
color=Colors.yellow,
['Player:']='<inline>'..player_name
['Player']='<inline>'..player_name
}
end)
Event.add(defines.events.on_player_unmuted, function(event)
@@ -230,7 +230,7 @@ if config.player_mutes then
title='Un-Muted',
description='A player has been un-muted',
color=Colors.green,
['Player:']='<inline>'..player_name
['Player']='<inline>'..player_name
}
end)
end
@@ -245,9 +245,9 @@ if config.player_kicks then
title='Kick',
description='A player has been kicked',
color=Colors.orange,
['Player:']='<inline>'..player_name,
['By:']='<inline>'..by_player.name,
['Reason:']=event.reason
['Player']='<inline>'..player_name,
['By']='<inline>'..by_player.name,
['Reason']=event.reason
}
end
end)
@@ -261,7 +261,7 @@ if config.player_promotes then
title='Promote',
description='A player has been promoted',
color=Colors.green,
['Player:']='<inline>'..player_name
['Player']='<inline>'..player_name
}
end)
Event.add(defines.events.on_player_demoted, function(event)
@@ -270,7 +270,7 @@ if config.player_promotes then
title='Demote',
description='A player has been demoted',
color=Colors.yellow,
['Player:']='<inline>'..player_name
['Player']='<inline>'..player_name
}
end)
end
@@ -284,8 +284,8 @@ Event.add(defines.events.on_console_command, function(event)
title=event.command:gsub('^%l', string.upper),
description='/'..event.command..' was used',
color=Colors.grey,
['By:']='<inline>'..player_name,
['Details:'] = event.parameters ~= '' and event.parameters or nil
['By']='<inline>'..player_name,
['Details'] = event.parameters ~= '' and event.parameters or nil
}
end
end