Files
Paradise/code/modules/world_topic/adminmsg.dm
S34N 0b838dc3c4 [READY] BYOND 516 compatability (#25105)
* Preliminary changes for 516

* Also removes the goon folder

* Fixes a BUNCH of UIs

* update our things

* debug proc

* le maintainer verb

* fix strip panel

* browseroutput => chat_panel

* prettier, remove obsolete bat

* tidu tgui say css

* href purge

* 515 compat

* 515 compat 2

* more required chores

* comments

* fully working 515

* bungle

* correct this

* fixes 515 support

* prettier

* new CI

* fixes old href styles sneaking in

* update docs to reflect href changes

* more href fixes (thanks cdui)

* MORE href nonsense

* even more hrefs (seriously wtf)

* Update code/modules/admin/permissionverbs/permissionedit.dm

* error on fail

---------

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
2024-04-15 18:49:50 +00:00

40 lines
1.4 KiB
Plaintext

/datum/world_topic_handler/adminmsg
topic_key = "adminmsg"
requires_commskey = TRUE
/datum/world_topic_handler/adminmsg/execute(list/input, key_valid)
/*
We got an adminmsg from the Discord bot, so lets split the input then validate the input. Expected output:
1. adminmsg = ckey of person the message is to
2. msg = contents of message, params2list requires
3. sender = the discord name that send the message.
*/
var/client/C
for(var/client/K in GLOB.clients)
if(K.ckey == input["adminmsg"])
C = K
break
if(!C)
return json_encode(list("error" = "No client with that name on server"))
var/sanitized = sanitize(input["msg"])
var/message = "<font color='red'>Discord PM from <b><a href='byond://?discord_msg=1'>[input["sender"]]</a></b>: [sanitized]</font>"
var/amessage = "<font color='#EB4E00'>Discord PM from <a href='byond://?discord_msg=1'>[input["sender"]]</a> to <b>[key_name_admin(C)]</b>: [sanitized]</font>"
// THESE TWO VARS DO VERY DIFFERENT THINGS. DO NOT ATTEMPT TO COMBINE THEM
C.received_discord_pm = world.time
C.last_discord_pm_time = 0
SEND_SOUND(C, sound('sound/effects/adminhelp.ogg'))
to_chat(C, message)
for(var/client/A in GLOB.admins)
// GLOB.admins includes anyone with a holder datum (mentors too). This makes sure only admins see ahelps
if(check_rights(R_ADMIN, FALSE, A.mob))
if(A != C)
to_chat(A, amessage)
return json_encode(list("success" = "Message Successful"))