Changes the discord bot into a subsystem and adds quite a bit of additional logging (#17996)

* Changes the discord bot into a subsystem and adds quite a bit of additional logging

* Removes a forgotten todo

* replaces call with RUSTG_CALL (to make it compile) and adds a comment

* Re-Add log prefix

---------

Co-authored-by: Werner <Arrow768@users.noreply.github.com>
This commit is contained in:
Werner
2023-12-19 23:54:57 +01:00
committed by GitHub
parent d0ca24467e
commit 3daec39efa
27 changed files with 219 additions and 135 deletions
+1 -1
View File
@@ -790,7 +790,7 @@ var/global/enabled_spooking = 0
var/long_message = " toggled hub visibility. The server is now [world.visibility ? "visible" : "invisible"] ([world.visibility])."
post_webhook_event(WEBHOOK_ADMIN, list("title"="Hub visibility has been toggled", "message"="**[key_name(src)]**" + long_message))
discord_bot.send_to_admins("[key_name(src)]" + long_message)
SSdiscord.send_to_admins("[key_name(src)]" + long_message)
message_admins("[key_name_admin(usr)]" + long_message, 1)
log_admin("[key_name(usr)] toggled hub visibility.")
feedback_add_details("admin_verb","THUB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc
+2 -2
View File
@@ -30,7 +30,7 @@ var/global/list/ticket_panels = list()
/datum/ticket/proc/broadcast_closure(closing_user)
var/client/owner_client = client_by_ckey(owner)
if(owner_client && owner_client.adminhelped == ADMINHELPED_DISCORD)
discord_bot.send_to_admins("[key_name(owner_client)]'s request for help has been closed/deemed unnecessary by [closing_user].")
SSdiscord.send_to_admins("[key_name(owner_client)]'s request for help has been closed/deemed unnecessary by [closing_user].")
owner_client.adminhelped = ADMINHELPED
/datum/ticket/proc/set_to_closed(closing_key)
@@ -101,7 +101,7 @@ var/global/list/ticket_panels = list()
var/client/owner_client = client_by_ckey(src.owner)
if(owner_client && owner_client.adminhelped == ADMINHELPED_DISCORD)
discord_bot.send_to_admins("[key_name(owner_client)]'s request for help has been taken by [key_name(assigned_admin)].")
SSdiscord.send_to_admins("[key_name(owner_client)]'s request for help has been taken by [key_name(assigned_admin)].")
owner_client.adminhelped = ADMINHELPED
message_admins("<span class='danger'><b>[key_name(assigned_admin)]</b> has assigned themself to <b>[src.owner]'s</b> ticket.</span>")
+1 -1
View File
@@ -58,7 +58,7 @@
objs += d
//to_chat(usr, "Query: [query_text]")
var/static/list/blacklist = list(/datum/configuration)
var/static/list/blacklist = list(/datum/configuration, /datum/controller/subsystem/discord)
for(var/datum/D in objs)
if(blacklist[D.type])
objs -= D
+1 -1
View File
@@ -134,7 +134,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","
log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins.",admin_key=key_name(src))
if(admin_number_active <= 0)
post_webhook_event(WEBHOOK_ADMIN_PM_IMPORTANT, list("title"="Help is requested", "message"="Request for Help from **[key_name(src)]**: ```[html_decode(original_msg)]```\n[admin_number_afk ? "All admins AFK ([admin_number_afk])" : "No admins online"]!!"))
discord_bot.send_to_admins("@here Request for Help from [key_name(src)]: [html_decode(original_msg)] - !![admin_number_afk ? "All admins AFK ([admin_number_afk])" : "No admins online"]!!")
SSdiscord.send_to_admins("@here Request for Help from [key_name(src)]: [html_decode(original_msg)] - !![admin_number_afk ? "All admins AFK ([admin_number_afk])" : "No admins online"]!!")
adminhelped = ADMINHELPED_DISCORD
feedback_add_details("admin_verb","AH") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return
+2 -2
View File
@@ -175,8 +175,8 @@
msg = sanitize(msg)
sender = sanitize(sender, encode=0)
post_webhook_event(WEBHOOK_ADMIN_PM, list("title"="Help is requested", "message"="PlayerPM to **[discord_escape(sender)]** from **[discord_escape(key_name(src))]**: ```[discord_escape(html_decode(msg))]```"))
discord_bot.send_to_admins("PlayerPM to [discord_escape(sender)] from [discord_escape(key_name(src))]: [discord_escape(html_decode(msg))]")
post_webhook_event(WEBHOOK_ADMIN_PM, list("title"="Help is requested", "message"="PlayerPM to **[SSdiscord.discord_escape(sender)]** from **[SSdiscord.discord_escape(key_name(src))]**: ```[SSdiscord.discord_escape(html_decode(msg))]```"))
SSdiscord.send_to_admins("PlayerPM to [SSdiscord.discord_escape(sender)] from [SSdiscord.discord_escape(key_name(src))]: [SSdiscord.discord_escape(html_decode(msg))]")
to_chat(src, "<span class='pm'><span class='out'>" + create_text_tag("PM <-", src) + " to <span class='name'>Discord-[sender]</span>: <span class='message linkify'>[msg]</span></span></span>")
+2 -2
View File
@@ -1,8 +1,8 @@
var/list/forbidden_varedit_object_types = list(
/datum/admins, //Admins editing their own admin-power object? Yup, sounds like a good idea.
/datum/controller/subsystem/statistics, //Prevents people messing with feedback gathering
/datum/feedback_variable, //Prevents people messing with feedback gathering
/datum/discord_bot //Nope.jpg. Stop it.
/datum/controller/subsystem/discord, //Nope.jpg
/datum/feedback_variable //Prevents people messing with feedback gathering
)
var/list/VVlocked = list("vars", "holder", "client", "virus", "viruses", "cuffed", "last_eaten", "unlock_content", "bound_x", "bound_y", "step_x", "step_y", "force_ending")
+2 -2
View File
@@ -43,7 +43,7 @@
to_chat(C, msg_cciaa)
discord_bot.send_to_cciaa("Emergency message from the station: `[msg]`, sent by [Sender]! Gamemode: [SSticker.mode]")
SSdiscord.send_to_cciaa("Emergency message from the station: `[msg]`, sent by [Sender]! Gamemode: [SSticker.mode]")
var/discord_msg = "[cciaa_present] agents online."
if (cciaa_present)
@@ -52,7 +52,7 @@
else
discord_msg += " [cciaa_afk] AFK."
discord_bot.send_to_cciaa(discord_msg)
SSdiscord.send_to_cciaa(discord_msg)
post_webhook_event(WEBHOOK_CCIAA_EMERGENCY_MESSAGE, list("message"=msg, "sender"="[Sender]", "cciaa_present"=cciaa_present, "cciaa_afk"=cciaa_afk))
/proc/Syndicate_announce(var/msg, var/mob/Sender)
@@ -21,8 +21,8 @@
if(!D)
return
var/static/list/blacklist = list(/datum/configuration)
if(blacklist[D.type])
var/static/list/blacklist = list(/datum/configuration, /datum/controller/subsystem/discord)
if(is_type_in_list(D,blacklist))
return
var/icon/sprite