Ahelp and Mhelp QOL (#24597)

* Bound ahelp/mhelp replies more tightly to their ticket.

* Hardened PMs further against missing data.

* Support expanding Discord notifications for ahelp/mhelp.

Functionality changes:
* Informs the user when their ticket is reopened.
* Informs other mentors/admins when tickets are converted.
* Discord messages now get a "Ticket 3, " or similar prefix.
  Not useful by itself, but will be with the following PR.

Code changes:
* When you create a ticket, you get the ticket object back.
* checkForTicket now allows you to fetch a ticket by number, and falls
  back to searching for open tickets if the ticket isn't found.
* Corrected and simplified the logic for adding PMs to tickets.
* Responses are now added through the ticket system, not the tickets
  directly.
This commit is contained in:
Charlie Nolan
2024-03-26 13:44:26 +00:00
committed by GitHub
parent b30890dd2a
commit e2f6212656
10 changed files with 95 additions and 62 deletions
+12 -5
View File
@@ -25,13 +25,20 @@
if(!msg) // No message after sanitisation
return
var/span_type
var/message_type
var/datum/ticket/T
if(selected_type == "Mentorhelp")
SSmentor_tickets.newHelpRequest(src, msg) // Mhelp
T = SSmentor_tickets.newHelpRequest(src, msg) // Mhelp
span_type = "mentorhelp"
message_type = MESSAGE_TYPE_MENTORPM
else
SStickets.newHelpRequest(src, msg) // Ahelp
T = SStickets.newHelpRequest(src, msg) // Ahelp
span_type = "adminhelp"
message_type = MESSAGE_TYPE_ADMINPM
//show it to the person adminhelping too
to_chat(src, "<span class='boldnotice'>[selected_type]</b>: [msg]</span>", MESSAGE_TYPE_ADMINPM, confidential = TRUE)
to_chat(src, "<span class='[span_type]'>[selected_type]</b>: [msg]</span>", message_type, confidential = TRUE)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Adminhelp") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
switch(selected_type)
@@ -41,11 +48,11 @@
var/active_admins = admincount[1]
log_admin("[selected_type]: [key_name(src)]: [msg] - heard by [active_admins] non-AFK admins.")
GLOB.discord_manager.send2discord_simple_noadmins("**\[Adminhelp]** [key_name(src)]: [msg]", check_send_always = TRUE)
GLOB.discord_manager.send2discord_simple_noadmins("**\[Adminhelp]** Ticket [T.ticketNum], [key_name(src)]: [msg]", check_send_always = TRUE)
if("Mentorhelp")
var/list/mentorcount = staff_countup(R_MENTOR)
var/active_mentors = mentorcount[1]
log_admin("[selected_type]: [key_name(src)]: [msg] - heard by [active_mentors] non-AFK mentors.")
GLOB.discord_manager.send2discord_simple_mentor("[key_name(src)]: [msg]")
GLOB.discord_manager.send2discord_simple_mentor("Ticket [T.ticketNum], [key_name(src)]: [msg]")