mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-21 20:28:40 +01:00
update tgs commands (#7511)
This commit is contained in:
@@ -1,45 +1,17 @@
|
||||
#define IRC_STATUS_THROTTLE 5
|
||||
|
||||
/datum/tgs_chat_command/ircstatus
|
||||
name = "status"
|
||||
help_text = "Gets the admincount, playercount, gamemode, and true game mode of the server"
|
||||
/datum/tgs_chat_command/reload_admins
|
||||
name = "reload_admins"
|
||||
help_text = "Forces the server to reload admins."
|
||||
admin_only = TRUE
|
||||
var/last_irc_status = 0
|
||||
|
||||
/datum/tgs_chat_command/ircstatus/Run(datum/tgs_chat_user/sender, params)
|
||||
var/rtod = REALTIMEOFDAY
|
||||
if(rtod - last_irc_status < IRC_STATUS_THROTTLE)
|
||||
return
|
||||
last_irc_status = rtod
|
||||
var/list/adm = get_admin_counts()
|
||||
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
|
||||
/datum/tgs_chat_command/reload_admins/Run(datum/tgs_chat_user/sender, params)
|
||||
ReloadAsync()
|
||||
log_admin("[sender.friendly_name] reloaded admins via chat command.")
|
||||
message_admins("[sender.friendly_name] reloaded admins via chat command.")
|
||||
return "Admins reloaded."
|
||||
|
||||
/datum/tgs_chat_command/irccheck
|
||||
name = "check"
|
||||
help_text = "Gets the playercount, gamemode, 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 = null //CONFIG_GET(string/server)
|
||||
//return "[round_id ? "Round #[round_id]: " : ""][clients.len] players on [SSmapping.config_legacy.map_name], Mode: [master_mode]; Round [SSticker.HasRoundStarted() ? (SSticker.IsRoundInProgress() ? "Active" : "Finishing") : "Starting"] -- [server ? server : "[world.internet_address]:[world.port]"]"
|
||||
var/current_state
|
||||
switch(SSticker.current_state)
|
||||
if(GAME_STATE_PREGAME)
|
||||
current_state = "pregame"
|
||||
if(GAME_STATE_SETTING_UP)
|
||||
current_state = "starting"
|
||||
if(GAME_STATE_PLAYING)
|
||||
current_state = "active"
|
||||
if(GAME_STATE_FINISHED)
|
||||
current_state = "finishing"
|
||||
return "[GLOB.clients.len] players on [(LEGACY_MAP_DATUM).name], Mode: [master_mode]; round [current_state] -- Duration [roundduration2text()] -- [server ? server : "[world.internet_address]:[world.port]"]"
|
||||
/datum/tgs_chat_command/reload_admins/proc/ReloadAsync()
|
||||
set waitfor = FALSE
|
||||
load_admins()
|
||||
|
||||
/datum/tgs_chat_command/ahelp
|
||||
name = "ahelp"
|
||||
@@ -49,7 +21,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)
|
||||
@@ -58,10 +30,8 @@
|
||||
if(AH)
|
||||
target = AH.initiator_ckey
|
||||
else
|
||||
return "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("Ticket #[id] not found!")
|
||||
return new /datum/tgs_message_content(IrcPm(target, all_params.Join(" "), sender.friendly_name))
|
||||
|
||||
/datum/tgs_chat_command/namecheck
|
||||
name = "namecheck"
|
||||
@@ -71,10 +41,10 @@
|
||||
/datum/tgs_chat_command/namecheck/Run(datum/tgs_chat_user/sender, params)
|
||||
params = trim(params)
|
||||
if(!params)
|
||||
return "Insufficient parameters"
|
||||
return new /datum/tgs_message_content("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"
|
||||
@@ -82,22 +52,7 @@
|
||||
admin_only = TRUE
|
||||
|
||||
/datum/tgs_chat_command/adminwho/Run(datum/tgs_chat_user/sender, params)
|
||||
return ircadminwho()
|
||||
|
||||
GLOBAL_LIST(round_end_notifiees)
|
||||
|
||||
/datum/tgs_chat_command/endnotify
|
||||
name = "notify"
|
||||
help_text = "Pings the invoker when the round ends"
|
||||
admin_only = FALSE
|
||||
|
||||
/datum/tgs_chat_command/endnotify/Run(datum/tgs_chat_user/sender, params)
|
||||
//if(!SSticker.IsRoundInProgress() && SSticker.HasRoundStarted())
|
||||
if(SSticker.current_state == GAME_STATE_FINISHED)
|
||||
return "[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(tgsadminwho())
|
||||
|
||||
/datum/tgs_chat_command/sdql
|
||||
name = "sdql"
|
||||
@@ -106,29 +61,79 @@ 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
|
||||
. = "[text_res.Join("\n")][refs ? "\nRefs: [refs.Join(" ")]" : ""]"
|
||||
return new /datum/tgs_message_content("[text_res.Join("\n")][refs ? "\nRefs: [refs.Join(" ")]" : ""]")
|
||||
|
||||
/datum/tgs_chat_command/reload_admins
|
||||
name = "reload_admins"
|
||||
help_text = "Forces the server to reload admins."
|
||||
/datum/tgs_chat_command/tgsstatus
|
||||
name = "status"
|
||||
help_text = "Gets the admincount, playercount, gamemode, and true game mode of the server"
|
||||
admin_only = TRUE
|
||||
|
||||
/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."
|
||||
/datum/tgs_chat_command/tgsstatus/Run(datum/tgs_chat_user/sender, params)
|
||||
var/list/adm = get_admin_counts()
|
||||
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(FALSE, TRUE, FALSE)]). Round has [SSticker.HasRoundStarted() ? "" : "not "]started."
|
||||
return new /datum/tgs_message_content(status)
|
||||
|
||||
/datum/tgs_chat_command/reload_admins/proc/ReloadAsync()
|
||||
set waitfor = FALSE
|
||||
load_admins()
|
||||
// code/modules/discord/tgs_commands.dm
|
||||
/datum/tgs_chat_command/tgscheck
|
||||
name = "check"
|
||||
help_text = "Gets the playercount, gamemode, and address of the server"
|
||||
|
||||
/datum/tgs_chat_command/tgscheck/Run(datum/tgs_chat_user/sender, params)
|
||||
var/server = config_legacy.serverurl || config_legacy.server
|
||||
return new /datum/tgs_message_content("[GLOB.round_id ? "Round #[GLOB.round_id]: " : ""][GLOB.clients.len] players on [(LEGACY_MAP_DATUM).name]; Round [SSticker.HasRoundStarted() ? (SSticker.IsRoundInProgress() ? "Active" : "Finishing") : "Starting"] -- [server ? server : "[world.internet_address]:[world.port]"]")
|
||||
|
||||
/datum/tgs_chat_command/gameversion
|
||||
name = "gameversion"
|
||||
help_text = "Gets the version details from the show-server-revision verb, basically"
|
||||
|
||||
/datum/tgs_chat_command/gameversion/Run(datum/tgs_chat_user/sender, params)
|
||||
var/list/msg = list("")
|
||||
msg += "BYOND Server Version: [world.byond_version].[world.byond_build] (Compiled with: [DM_VERSION].[DM_BUILD])\n"
|
||||
|
||||
if (!GLOB.revdata)
|
||||
msg += "No revision information found."
|
||||
else
|
||||
msg += "Revision [copytext_char(GLOB.revdata.commit, 1, 9)]"
|
||||
if (GLOB.revdata.date)
|
||||
msg += " compiled on '[GLOB.revdata.date]'"
|
||||
|
||||
if(GLOB.revdata.originmastercommit)
|
||||
msg += ", from origin commit: <[CONFIG_GET(string/githuburl)]/commit/[GLOB.revdata.originmastercommit]>"
|
||||
|
||||
if(GLOB.revdata.testmerge.len)
|
||||
msg += "\n"
|
||||
for(var/datum/tgs_revision_information/test_merge/PR as anything in GLOB.revdata.testmerge)
|
||||
msg += "PR #[PR.number] at [copytext_char(PR.head_commit, 1, 9)] [PR.title].\n"
|
||||
if (PR.url)
|
||||
msg += "<[PR.url]>\n"
|
||||
return new /datum/tgs_message_content(msg.Join(""))
|
||||
|
||||
GLOBAL_LIST(round_end_notifiees)
|
||||
/datum/tgs_chat_command/endnotify
|
||||
name = "notify"
|
||||
help_text = "Pings the invoker when the round ends"
|
||||
admin_only = FALSE
|
||||
|
||||
/datum/tgs_chat_command/endnotify/Run(datum/tgs_chat_user/sender, params)
|
||||
//if(!SSticker.IsRoundInProgress() && SSticker.HasRoundStarted())
|
||||
if(SSticker.current_state == GAME_STATE_FINISHED)
|
||||
return new /datum/tgs_message_content("[sender.mention], the round has already ended!")
|
||||
LAZYINITLIST(GLOB.round_end_notifiees)
|
||||
if (GLOB.round_end_notifiees[sender.mention])
|
||||
GLOB.round_end_notifiees[sender.mention] = FALSE
|
||||
return new /datum/tgs_message_content("You will no longer be notified when the server restarts")
|
||||
GLOB.round_end_notifiees[sender.mention] = TRUE
|
||||
return new /datum/tgs_message_content("You will now be notified when the server restarts")
|
||||
|
||||
/datum/tgs_chat_command/whitelist
|
||||
name = "whitelist"
|
||||
|
||||
@@ -613,7 +613,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ahelp)
|
||||
msg2 = replacetext(replacetext(msg2, "\proper", ""), "\improper", "")
|
||||
world.TgsTargetedChatBroadcast("[msg] | [msg2]", TRUE)
|
||||
|
||||
/proc/ircadminwho()
|
||||
/proc/tgsadminwho()
|
||||
var/list/message = list("Admins: ")
|
||||
var/list/admin_keys = list()
|
||||
for(var/adm in GLOB.admins)
|
||||
@@ -621,7 +621,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ahelp)
|
||||
admin_keys += "[C][C.holder.fakekey ? "(Stealth)" : ""][C.is_afk() ? "(AFK)" : ""]"
|
||||
|
||||
for(var/admin in admin_keys)
|
||||
if(LAZYLEN(admin_keys) > 1)
|
||||
if(LAZYLEN(message) > 1)
|
||||
message += ", [admin]"
|
||||
else
|
||||
message += "[admin]"
|
||||
|
||||
Reference in New Issue
Block a user