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 22:54:57 +00:00
committed by GitHub
co-authored by Werner
parent d0ca24467e
commit 3daec39efa
27 changed files with 219 additions and 135 deletions
+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)