<commit_before>//shows a list of clients we could send PMs to, then forwards our choice to cmd_Mentor_pm
/client/proc/cmd_mentor_pm_panel()
	set category = "Mentor"
	set name = "Mentor PM"

	if(!is_mentor())
		to_chat(src, "<font color='red'>Error: Mentor-PM-Panel: Only Mentors and Admins may use this command.</font>")
		return

	var/list/client/targets[0]
	for(var/client/T)
		targets["[T]"] = T

	var/list/sorted = sortList(targets)
	var/target = input(src,"To whom shall we send a message?","Mentor PM",null) in sorted|null
	cmd_mentor_pm(targets[target],null)
	SSblackbox.record_feedback("tally", "Mentor_verb", 1, "APM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!


//takes input from cmd_mentor_pm_context, cmd_Mentor_pm_panel or /client/Topic and sends them a PM.
//Fetching a message if needed. src is the sender and C is the target client
/client/proc/cmd_mentor_pm(whom, msg, discord_id)
	var/client/C
	if(ismob(whom))
		var/mob/M = whom
		C = M.client

	else if(istext(whom) && !discord_id)
		C = GLOB.directory[whom]

	else if(istype(whom,/client))
		C = whom

	if(QDELETED(C) && !discord_id)
		if(is_mentor())
			to_chat(src, "<font color='red'>Error: Mentor-PM: Client not found.</font>")
		else
			mentorhelp(msg)	//Mentor we are replying to left. Mentorhelp instead(check below)
		return

	//get message text, limit it's length.and clean/escape html
	if(!msg)
		msg = input(src,"Message:", "Private message") as text|null

		if(!msg)
			return

		// Neither party is a mentor, they shouldn't be PMing!
		if (C && !C.is_mentor() && !is_mentor())
			return

	if(discord_id)
		webhook_send_mhelp("[key_name_mentor(src)]-><@[discord_id]>", msg)
	else
		webhook_send_mhelp("[key_name_mentor(src)]->[key_name_mentor(C)]", msg)

	msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
	if(!msg)
		return

	log_mentor("Mentor PM: [key_name(src)]->[discord_id ? discord_id : key_name(C)]: [msg]")

	if(mentor_datum && isnotpretty(msg)) // If this is, specifically, a mentor, and not an admin nor a normal player
		to_chat(src,"<span class='danger'>You cannot send bigoted language as a mentor.</span>")
		message_admins("[discord_id ? discord_id : key_name(src)] just tripped the pretty filter in a mentorpm: [msg]")
		return
	msg = emoji_parse(msg)
	if(C)
		send_mentor_sound(C)
	var/show_char = CONFIG_GET(flag/mentors_mobname_only)
	if(!C || C.is_mentor())
		if(C)
			to_chat(C, "<span class='purple'>Reply PM from-<b>[key_name_mentor(src, C, 1, 0, show_char)]</b>: [msg]</span>")
		if(discord_id)
			to_chat(src, "<font color='green'>Mentor PM to-<b>[discord_mentor_link(whom, discord_id)]</b>: [msg]</font>")
		else
			to_chat(src, "<font color='green'>Mentor PM to-<b>[key_name_mentor(C, C, 1, 0, 0)]</b>: [msg]</font>")
		if(ckey in SSYogs.mentortickets)
			var/datum/mentorticket/T = SSYogs.mentortickets[ckey]
			T.log += "<b>[key]:</b> [msg]"

	else
		if(is_mentor())	//sender is an mentor but recipient is not.
			if(C)
				to_chat(C, "<span class='purple'>Mentor PM from-<b>[key_name_mentor(src, C, 1, 0, 0)]</b>: [msg]</span>")
			to_chat(src, "<font color='green'>Mentor PM to-<b>[key_name_mentor(C, C, 1, 0, show_char)]</b>: [msg]</font>")
			if(C.ckey in SSYogs.mentortickets)
				var/datum/mentorticket/T = SSYogs.mentortickets[C.ckey]
				T.log += "<b>[key]:</b> [msg]"

	webhook_send_mres(C, src, msg)

	//we don't use message_Mentors here because the sender/receiver might get it too
	var/show_char_sender = !is_mentor() && CONFIG_GET(flag/mentors_mobname_only)
	var/show_char_recip = C && !C.is_mentor() && CONFIG_GET(flag/mentors_mobname_only)
	for(var/client/X in GLOB.mentors | (GLOB.admins - GLOB.deadmins))
		if(X.key != key && (!C || X.key != C.key))	//check client/X is an Mentor and isn't the sender or recipient
			if(discord_id)
				to_chat(X, "<B><font color='green'>Mentor PM: [key_name_mentor(src, X, 0, 0, show_char_sender)]-&gt;[discord_mentor_link(whom, discord_id)]:</B> <font color ='blue'> [msg]</font>") //inform X
			else
				to_chat(X, "<B><font color='green'>Mentor PM: [key_name_mentor(src, X, 0, 0, show_char_sender)]-&gt;[key_name_mentor(C, X, 0, 0, show_char_recip)]:</B> <font color ='blue'> [msg]</font>") //inform X<commit_msg>Changes mhelp blue, piggybacks on 'blueteamradio'<commit_after>//shows a list of clients we could send PMs to, then forwards our choice to cmd_Mentor_pm
/client/proc/cmd_mentor_pm_panel()
	set category = "Mentor"
	set name = "Mentor PM"

	if(!is_mentor())
		to_chat(src, "<font color='red'>Error: Mentor-PM-Panel: Only Mentors and Admins may use this command.</font>")
		return

	var/list/client/targets[0]
	for(var/client/T)
		targets["[T]"] = T

	var/list/sorted = sortList(targets)
	var/target = input(src,"To whom shall we send a message?","Mentor PM",null) in sorted|null
	cmd_mentor_pm(targets[target],null)
	SSblackbox.record_feedback("tally", "Mentor_verb", 1, "APM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!


//takes input from cmd_mentor_pm_context, cmd_Mentor_pm_panel or /client/Topic and sends them a PM.
//Fetching a message if needed. src is the sender and C is the target client
/client/proc/cmd_mentor_pm(whom, msg, discord_id)
	var/client/C
	if(ismob(whom))
		var/mob/M = whom
		C = M.client

	else if(istext(whom) && !discord_id)
		C = GLOB.directory[whom]

	else if(istype(whom,/client))
		C = whom

	if(QDELETED(C) && !discord_id)
		if(is_mentor())
			to_chat(src, "<font color='red'>Error: Mentor-PM: Client not found.</font>")
		else
			mentorhelp(msg)	//Mentor we are replying to left. Mentorhelp instead(check below)
		return

	//get message text, limit it's length.and clean/escape html
	if(!msg)
		msg = input(src,"Message:", "Private message") as text|null

		if(!msg)
			return

		// Neither party is a mentor, they shouldn't be PMing!
		if (C && !C.is_mentor() && !is_mentor())
			return

	if(discord_id)
		webhook_send_mhelp("[key_name_mentor(src)]-><@[discord_id]>", msg)
	else
		webhook_send_mhelp("[key_name_mentor(src)]->[key_name_mentor(C)]", msg)

	msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
	if(!msg)
		return

	log_mentor("Mentor PM: [key_name(src)]->[discord_id ? discord_id : key_name(C)]: [msg]")

	if(mentor_datum && isnotpretty(msg)) // If this is, specifically, a mentor, and not an admin nor a normal player
		to_chat(src,"<span class='danger'>You cannot send bigoted language as a mentor.</span>")
		message_admins("[discord_id ? discord_id : key_name(src)] just tripped the pretty filter in a mentorpm: [msg]")
		return
	msg = emoji_parse(msg)
	if(C)
		send_mentor_sound(C)
	var/show_char = CONFIG_GET(flag/mentors_mobname_only)
	if(!C || C.is_mentor())
		if(C)
			to_chat(C, "<span class='purple'>Reply PM from-<b>[key_name_mentor(src, C, 1, 0, show_char)]</b>: [msg]</span>")
		if(discord_id)
			to_chat(src, "<font color='green'>Mentor PM to-<b>[discord_mentor_link(whom, discord_id)]</b>: [msg]</font>")
		else
			to_chat(src, "<font color='green'>Mentor PM to-<b>[key_name_mentor(C, C, 1, 0, 0)]</b>: [msg]</font>")
		if(ckey in SSYogs.mentortickets)
			var/datum/mentorticket/T = SSYogs.mentortickets[ckey]
			T.log += "<b>[key]:</b> [msg]"

	else
		if(is_mentor())	//sender is an mentor but recipient is not.
			if(C)
				to_chat(C, "<span class='purple'>Mentor PM from-<b>[key_name_mentor(src, C, 1, 0, 0)]</b>: [msg]</span>")
			to_chat(src, "<font color='green'>Mentor PM to-<b>[key_name_mentor(C, C, 1, 0, show_char)]</b>: [msg]</font>")
			if(C.ckey in SSYogs.mentortickets)
				var/datum/mentorticket/T = SSYogs.mentortickets[C.ckey]
				T.log += "<b>[key]:</b> [msg]"

	webhook_send_mres(C, src, msg)

	//we don't use message_Mentors here because the sender/receiver might get it too
	var/show_char_sender = !is_mentor() && CONFIG_GET(flag/mentors_mobname_only)
	var/show_char_recip = C && !C.is_mentor() && CONFIG_GET(flag/mentors_mobname_only)
	for(var/client/X in GLOB.mentors | (GLOB.admins - GLOB.deadmins))
		if(X.key != key && (!C || X.key != C.key))	//check client/X is an Mentor and isn't the sender or recipient
			if(discord_id)
				to_chat(X, "<B><font color='green'>Mentor PM: [key_name_mentor(src, X, 0, 0, show_char_sender)]-&gt;[discord_mentor_link(whom, discord_id)]:</B> <span class='blueteamradio'> [msg]</span>") //inform X
			else
				to_chat(X, "<B><font color='green'>Mentor PM: [key_name_mentor(src, X, 0, 0, show_char_sender)]-&gt;[key_name_mentor(C, X, 0, 0, show_char_recip)]:</B> <span class='blueteamradio'> [msg]</span>") //inform X
{'fraction_non_alphanumeric': 0.1668236402166235, 'fraction_numerical': 0.0047092064987049684, 'mean_word_length': 4.858620689655172, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2968148', 'n_tokens_mistral': 3652, 'n_tokens_neox': 3395, 'n_words': 788}