Skip to content

Commit

Permalink
tgs logging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Feb 3, 2024
1 parent 1574a5a commit 23f2402
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
3 changes: 2 additions & 1 deletion code/datums/entities/player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ BSQL_PROTECT_DATUM(/datum/entity/player)

if(banner)
permaban_admin_id = banner.id
important_log_and_message_admins("[key_name_admin(banner.owning_client)] has permanently banned [ckey] for [reason].")
log_and_message_admins("[key_name_admin(banner.owning_client)] has permanently banned [ckey] for '[reason]'.")
important_message_external("[banner.owning_client] has permanently banned [ckey] for '[reason].")
add_note("Permanently banned | [reason]", FALSE, NOTE_ADMIN, TRUE)

if(owning_client)
Expand Down
15 changes: 12 additions & 3 deletions code/defines/procs/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
log_admin("[key_name(usr)] [message]")
message_admins("[key_name(usr)] [message]")

/proc/important_log_and_message_admins(message)
log_and_message_admins(message)
/proc/important_message_external(message)
if(CONFIG_GET(string/important_log_channel))
send2chat(new /datum/tgs_message_content(message), CONFIG_GET(string/important_log_channel))
var/datum/tgs_message_content/to_send = new("")

var/datum/tgs_chat_embed/structure/embed = new()
embed.title = "Important Log"
embed.description = message
embed.timestamp = time2text(world.timeofday, "YYYY-MM-DD hh:mm:ss")
embed.color = "#ED2939"

to_send.embed = embed

send2chat(to_send, CONFIG_GET(string/important_log_channel))
3 changes: 2 additions & 1 deletion code/modules/admin/NewBan.dm
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,5 @@ GLOBAL_DATUM(Banlist, /savefile)
SSstickyban.add_matched_ip(new_sticky.id, ip)

log_admin("STICKYBAN: Identifier: [identifier] Reason: [reason] Message: [message] CKEYs: [english_list(impacted_ckeys)] IPs: [english_list(impacted_ips)] CIDs: [english_list(impacted_cids)]")
important_log_and_message_admins("[key_name_admin(src)] has added a new stickyban with the identifier '[identifier]'.")
log_and_message_admins("[key_name_admin(src)] has added a new stickyban with the identifier '[identifier]'.")
important_message_external("[src] has added a new stickyban with the identifier '[identifier]'.")
22 changes: 14 additions & 8 deletions code/modules/admin/topic/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@

unban_player.save()

important_log_and_message_admins("[key_name_admin(owner)] has removed the permanent ban on [unban_player.ckey].")
log_and_message_admins("[key_name_admin(owner)] has removed the permanent ban on [unban_player.ckey].")
important_message_external("[owner] has removed the permanent ban on [unban_player.ckey].")

else if(href_list["sticky"])
if(href_list["view_all_ckeys"])
Expand Down Expand Up @@ -306,7 +307,8 @@
return

SSstickyban.whitelist_ckey(sticky.id, ckey_to_whitelist)
important_log_and_message_admins("[key_name_admin(owner)] has whitelisted [ckey_to_whitelist] against stickyban [sticky.identifier].")
log_and_message_admins("[key_name_admin(owner)] has whitelisted [ckey_to_whitelist] against stickyban '[sticky.identifier]'.")
important_message_external("[owner] has whitelisted [ckey_to_whitelist] against stickyban '[sticky.identifier]'.")

if(href_list["add"])
var/option = tgui_input_list(owner, "What do you want to add?", "AddABan", list("CID", "CKEY", "IP"))
Expand All @@ -325,8 +327,8 @@
if("IP")
SSstickyban.add_matched_ip(sticky.id, to_add)

important_log_and_message_admins("[key_name_admin(owner)] has added a [option] ([to_add]) to stickyban [sticky.identifier].")

log_and_message_admins("[key_name_admin(owner)] has added a [option] ([to_add]) to stickyban '[sticky.identifier]'.")
important_message_external("[owner] has added a [option] ([to_add]) to stickyban '[sticky.identifier]'.")

if(href_list["remove"])
var/option = tgui_input_list(owner, "What do you want to remove?", "DelABan", list("Entire Stickyban", "CID", "CKEY", "IP"))
Expand All @@ -338,7 +340,8 @@
sticky.active = FALSE
sticky.save()

important_log_and_message_admins("[key_name_admin(owner)] has deactivated stickyban [sticky.identifier].")
log_and_message_admins("[key_name_admin(owner)] has deactivated stickyban '[sticky.identifier]'.")
important_message_external("[owner] has deactivated stickyban '[sticky.identifier]'.")

if("CID")
var/list/datum/view_record/stickyban_matched_cid/all_cids = DB_VIEW(/datum/view_record/stickyban_matched_cid,
Expand All @@ -358,7 +361,8 @@
var/datum/entity/stickyban_matched_cid/sticky_cid = DB_ENTITY(/datum/entity/stickyban_matched_cid, selected)
sticky_cid.delete()

important_log_and_message_admins("[key_name_admin(owner)] has removed a CID ([picked]) from stickyban [sticky.identifier].")
log_and_message_admins("[key_name_admin(owner)] has removed a CID ([picked]) from stickyban '[sticky.identifier]'.")
important_message_external("[owner] has removed a CID ([picked]) from stickyban '[sticky.identifier]'.")

if("CKEY")
var/list/datum/view_record/stickyban_matched_ckey/all_ckeys = DB_VIEW(/datum/view_record/stickyban_matched_ckey,
Expand All @@ -378,7 +382,8 @@
var/datum/entity/stickyban_matched_ckey/sticky_ckey = DB_ENTITY(/datum/entity/stickyban_matched_ckey, selected)
sticky_ckey.delete()

important_log_and_message_admins("[key_name_admin(owner)] has removed a CID ([picked]) from stickyban [sticky.identifier].")
log_and_message_admins("[key_name_admin(owner)] has removed a CKEY ([picked]) from stickyban '[sticky.identifier]'.")
important_message_external("[owner] has removed a CKEY ([picked]) from stickyban '[sticky.identifier]'.")

if("IP")
var/list/datum/view_record/stickyban_matched_ip/all_ips = DB_VIEW(/datum/view_record/stickyban_matched_ip,
Expand All @@ -398,7 +403,8 @@
var/datum/entity/stickyban_matched_ip/sticky_ip = DB_ENTITY(/datum/entity/stickyban_matched_ip, selected)
sticky_ip.delete()

important_log_and_message_admins("[key_name_admin(owner)] has removed an IP ([picked]) from stickyban [sticky.identifier].")
log_and_message_admins("[key_name_admin(owner)] has removed an IP ([picked]) from stickyban [sticky.identifier].")
important_message_external("[owner] has removed an IP ([picked]) from stickyban '[sticky.identifier].")

else if(href_list["warn"])
usr.client.warn(href_list["warn"])
Expand Down

0 comments on commit 23f2402

Please sign in to comment.