[s] send2adminchat now stops links from embedding.

This commit is contained in:
Ghommie
2020-11-02 16:52:08 +01:00
parent 557b264670
commit e5aca5a78c
2 changed files with 6 additions and 1 deletions

View File

@@ -66,7 +66,9 @@ In TGS3 it will always be sent to all connected designated game chats.
* category - The category of the mssage.
* message - The message to send.
*/
/proc/send2adminchat(category, message)
/proc/send2adminchat(category, message, embed_links = FALSE)
category = replacetext(replacetext(category, "\proper", ""), "\improper", "")
message = replacetext(replacetext(message, "\proper", ""), "\improper", "")
if(!embed_links)
message = GLOB.has_discord_embeddable_links.Replace(message, "<$1>")
world.TgsTargetedChatBroadcast("[category] | [message]", TRUE)

View File

@@ -5,3 +5,6 @@ GLOBAL_DATUM_INIT(is_website, /regex, regex("http|www.|\[a-z0-9_-]+.(com|org|net
GLOBAL_DATUM_INIT(is_email, /regex, regex("\[a-z0-9_-]+@\[a-z0-9_-]+.\[a-z0-9_-]+", "i"))
GLOBAL_DATUM_INIT(is_alphanumeric, /regex, regex("\[a-z0-9]+", "i"))
GLOBAL_DATUM_INIT(is_punctuation, /regex, regex("\[.!?]+", "i"))
//finds text strings recognized as links on discord. Mainly used to stop embedding.
GLOBAL_DATUM_INIT(has_discord_embeddable_links, /regex, regex("(https?://\[^\\s|<\]{2,})"))