quick dmapi stuff update

This commit is contained in:
SandPoot
2023-10-10 18:30:48 -03:00
parent e19de0d8cb
commit 41671a5f22
8 changed files with 70 additions and 48 deletions
+19 -33
View File
@@ -15,22 +15,8 @@
var/list/allmins = adm["total"]
var/status = "Admins: [allmins.len] (Active: [english_list(adm["present"])] AFK: [english_list(adm["afk"])] Stealth: [english_list(adm["stealth"])] Skipped: [english_list(adm["noflags"])]). "
status += "Players: [GLOB.clients.len] (Active: [get_active_player_count(0,1,0)]). Mode: [SSticker.mode ? SSticker.mode.name : "Not started"]."
return status
return new /datum/tgs_message_content(status)
/datum/tgs_chat_command/irccheck
name = "check"
help_text = "Gets the playercount, round info, and address of the server"
var/last_irc_check = 0
/datum/tgs_chat_command/irccheck/Run(datum/tgs_chat_user/sender, params)
var/rtod = REALTIMEOFDAY
if(rtod - last_irc_check < IRC_STATUS_THROTTLE)
return
last_irc_check = rtod
var/server = CONFIG_GET(string/server)
return "[GLOB.round_id ? "Round #[GLOB.round_id]: " : ""][GLOB.clients.len] players on [SSmapping.config.map_name]; Round [SSticker.HasRoundStarted() ? (SSticker.IsRoundInProgress() ? "Active for [DisplayTimeText(world.time - SSticker.round_start_time, 1)]" : "Finishing") : "Starting"] -- [server ? server : "<byond://[world.internet_address]:[world.port]"]>"
//CIT CHANGE obfuscates the gamemode for TGS bot commands on discord by removing Mode:[GLOB.master_mode]
//sandstorm change, says how long the round has been on for
/datum/tgs_chat_command/ahelp
name = "ahelp"
help_text = "<ckey|ticket #> <message|ticket <close|resolve|icissue|reject|reopen <ticket #>|list>>"
@@ -39,7 +25,7 @@
/datum/tgs_chat_command/ahelp/Run(datum/tgs_chat_user/sender, params)
var/list/all_params = splittext(params, " ")
if(all_params.len < 2)
return "Insufficient parameters"
return new /datum/tgs_message_content("Insufficient parameters")
var/target = all_params[1]
all_params.Cut(1, 2)
var/id = text2num(target)
@@ -48,10 +34,10 @@
if(AH)
target = AH.initiator_ckey
else
return "Ticket #[id] not found!"
return new /datum/tgs_message_content("Ticket #[id] not found!")
var/res = IrcPm(target, all_params.Join(" "), sender.friendly_name)
if(res != "Message Successful")
return res
return new /datum/tgs_message_content(res)
/datum/tgs_chat_command/namecheck
name = "namecheck"
@@ -64,7 +50,7 @@
return "Insufficient parameters"
log_admin("Chat Name Check: [sender.friendly_name] on [params]")
message_admins("Name checking [params] from [sender.friendly_name]")
return keywords_lookup(params, 1)
return new /datum/tgs_message_content(keywords_lookup(params, 1))
/datum/tgs_chat_command/adminwho
name = "adminwho"
@@ -72,7 +58,7 @@
admin_only = TRUE
/datum/tgs_chat_command/adminwho/Run(datum/tgs_chat_user/sender, params)
return ircadminwho()
return new /datum/tgs_message_content(ircadminwho())
GLOBAL_LIST(round_end_notifiees)
@@ -83,10 +69,10 @@ GLOBAL_LIST(round_end_notifiees)
/datum/tgs_chat_command/notify/Run(datum/tgs_chat_user/sender, params)
if(!SSticker.IsRoundInProgress() && SSticker.HasRoundStarted())
return "[sender.mention], the round has already ended!"
return new /datum/tgs_message_content("[sender.mention], the round has already ended!")
LAZYINITLIST(GLOB.round_end_notifiees)
GLOB.round_end_notifiees[sender.mention] = TRUE
return "I will notify [sender.mention] when the round ends."
return new /datum/tgs_message_content("I will notify [sender.mention] when the round ends.")
/datum/tgs_chat_command/sdql
name = "sdql"
@@ -95,12 +81,12 @@ GLOBAL_LIST(round_end_notifiees)
/datum/tgs_chat_command/sdql/Run(datum/tgs_chat_user/sender, params)
if(GLOB.AdminProcCaller)
return "Unable to run query, another admin proc call is in progress. Try again later."
return new /datum/tgs_message_content("Unable to run query, another admin proc call is in progress. Try again later.")
GLOB.AdminProcCaller = "CHAT_[sender.friendly_name]" //_ won't show up in ckeys so it'll never match with a real admin
var/list/results = world.SDQL2_query(params, GLOB.AdminProcCaller, GLOB.AdminProcCaller)
GLOB.AdminProcCaller = null
if(!results)
return "Query produced no output"
return new /datum/tgs_message_content("Query produced no output")
var/list/text_res = results.Copy(1, 3)
var/list/refs = results.len > 3 ? results.Copy(4) : null
if(refs)
@@ -112,7 +98,7 @@ GLOBAL_LIST(round_end_notifiees)
else
L += "[ref]"
refs = L
. = "[text_res.Join("\n")][refs ? "\nRefs: [refs.Join(" ")]" : ""]"
. = new /datum/tgs_message_content("[text_res.Join("\n")][refs ? "\nRefs: [refs.Join(" ")]" : ""]")
/datum/tgs_chat_command/reload_admins
name = "reload_admins"
@@ -122,7 +108,7 @@ GLOBAL_LIST(round_end_notifiees)
/datum/tgs_chat_command/reload_admins/Run(datum/tgs_chat_user/sender, params)
ReloadAsync()
log_admin("[sender.friendly_name] reloaded admins via chat command.")
return "Admins reloaded."
return new /datum/tgs_message_content("Admins reloaded.")
/datum/tgs_chat_command/reload_admins/proc/ReloadAsync()
set waitfor = FALSE
@@ -135,14 +121,14 @@ GLOBAL_LIST(round_end_notifiees)
/datum/tgs_chat_command/addbunkerbypass/Run(datum/tgs_chat_user/sender, params)
if(!CONFIG_GET(flag/sql_enabled))
return "The Database is not enabled!"
return new /datum/tgs_message_content("The Database is not enabled!")
GLOB.bunker_passthrough |= ckey(params)
GLOB.bunker_passthrough[ckey(params)] = world.realtime
SSpersistence.SavePanicBunker() //we can do this every time, it's okay
log_admin("[sender.friendly_name] has added [params] to the current round's bunker bypass list.")
message_admins("[sender.friendly_name] has added [params] to the current round's bunker bypass list.")
return "[params] has been added to the current round's bunker bypass list."
return new /datum/tgs_message_content("[params] has been added to the current round's bunker bypass list.")
// More (silly) chat commands citadel added.
/datum/tgs_chat_command/wheelofsalt
@@ -159,21 +145,21 @@ GLOBAL_LIST(round_end_notifiees)
saltresult += " @everyone gets some salt this time too"
else
saltresult += "[saltprimarysubject] [saltsecondarysubject]"
return "[saltresult]!"
return new /datum/tgs_message_content("[saltresult]!")
/datum/tgs_chat_command/valentine
name = "valentine"
help_text = "Get a random flirt line."
/datum/tgs_chat_command/valentine/Run(datum/tgs_chat_user/sender, params)
return "[pick(GLOB.flirts)]"
return new /datum/tgs_message_content("[pick(GLOB.flirts)]")
/datum/tgs_chat_command/despacito
name = "despacito" //someone please high effort this sometime and make it a full on ytdl search
help_text = "This is so sad."
/datum/tgs_chat_command/despacito/Run()
return "https://www.youtube.com/watch?v=kJQP7kiw5Fk"
return new /datum/tgs_message_content("https://www.youtube.com/watch?v=kJQP7kiw5Fk")
/datum/tgs_chat_command/polly
name = "polly"
@@ -187,7 +173,7 @@ GLOBAL_LIST(round_end_notifiees)
else
var/json_file = file("data/npc_saves/Poly.json")
if(!fexists(json_file))
return "**BAWWWWWK!** LEAVE THE HEADSET! ***BAWKKKKK!!***"
return new /datum/tgs_message_content("**BAWWWWWK!** LEAVE THE HEADSET! ***BAWKKKKK!!***")
var/list/json = json_decode(file2text(json_file))
speech_buffer = json["phrases"]
return "[pick(speech_buffer)]"
return new /datum/tgs_message_content("[pick(speech_buffer)]")