[MIRROR] Adds more documentation to TGS chat funcs (#172)

* Adds more documentation to TGS chat funcs (#52601)

* Adds more documentation to TGS chat funcs

Co-authored-by: Jordan Brown <Cyberboss@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-08-02 17:57:00 +01:00
committed by GitHub
co-authored by Jordan Brown
parent 5caa10a224
commit 175bde80cf
3 changed files with 73 additions and 36 deletions
-36
View File
@@ -147,39 +147,3 @@ SUBSYSTEM_DEF(discord)
var/datum/http_response/res = req.into_response()
WRITE_LOG(GLOB.discord_api_log, "PUT [url] returned [res.status_code] [res.body]")
/**
* Sends a message to TGS chat channels.
*
* message - The message to send.
* channel_tag - Required. If "", the message with be sent to all connected (Game-type for TGS3) channels. Otherwise, it will be sent to TGS4 channels with that tag (Delimited by ','s).
*/
/proc/send2chat(message, channel_tag)
if(channel_tag == null || !world.TgsAvailable())
return
var/datum/tgs_version/version = world.TgsVersion()
if(channel_tag == "" || version.suite == 3)
world.TgsTargetedChatBroadcast(message, FALSE)
return
var/list/channels_to_use = list()
for(var/I in world.TgsChatChannelInfo())
var/datum/tgs_chat_channel/channel = I
var/list/applicable_tags = splittext(channel.tag, ",")
if(channel_tag in applicable_tags)
channels_to_use += channel
if(channels_to_use.len)
world.TgsChatBroadcast(message, channels_to_use)
/**
* Sends a message to TGS admin chat channels.
*
* category - The category of the mssage.
* message - The message to send.
*/
/proc/send2adminchat(category, message)
category = replacetext(replacetext(category, "\proper", ""), "\improper", "")
message = replacetext(replacetext(message, "\proper", ""), "\improper", "")
world.TgsTargetedChatBroadcast("[category] | [message]", TRUE)