Adds SDQL chat command (#33366)

Allow's calling SDQL from bots supporting the CHAT system API
This commit is contained in:
Jordan Brown
2017-12-14 16:43:54 -05:00
committed by CitadelStationBot
parent a22b225015
commit 253a3d519e
3 changed files with 30 additions and 6 deletions
+16
View File
@@ -82,6 +82,22 @@ GLOBAL_LIST(round_end_notifiees)
GLOB.round_end_notifiees[sender] = TRUE
return "I will notify [sender] when the round ends."
/datum/server_tools_command/sdql
name = "sdql"
help_text = "Runs an SDQL query"
admin_only = TRUE
/datum/server_tools_command/sdql/Run(sender, params)
if(GLOB.AdminProcCaller)
return "Unable to run query, another admin proc call is in progress. Try again later."
GLOB.AdminProcCaller = "CHAT_[sender]" //_ 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)
if(!results)
return "Query produced no output"
var/list/text_res = results.Copy(1, 3)
var/list/refs = results.len > 3 ? results.Copy(4) : null
. = "[text_res.Join("\n")][refs ? "\nRefs: [refs.Join(" ")]" : ""]"
/datum/server_tools_command/reload_admins
name = "reload_admins"
help_text = "Forces the server to reload admins."