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
+6 -2
View File
@@ -7,7 +7,7 @@
* Circumvents the message queue and sends the message to the recipient (target) as soon as possible.
* trailing_newline, confidential, and handle_whitespace currently have no effect, please fix this in the future or remove the arguments to lower cache!
*/
/proc/to_chat_immediate(target, html, type, text, avoid_highlighting = FALSE, handle_whitespace = TRUE, trailing_newline = TRUE, confidential = FALSE)
/proc/to_chat_immediate(target, html, type, text, avoid_highlighting = FALSE, handle_whitespace = TRUE, trailing_newline = TRUE, confidential = FALSE, ticket_id = -1)
// Useful where the integer 0 is the entire message. Use case is enabling to_chat(target, some_boolean) while preventing to_chat(target, "")
html = "[html]"
text = "[text]"
@@ -29,6 +29,8 @@
message["html"] = html
if(avoid_highlighting)
message["avoidHighlighting"] = avoid_highlighting
if(ticket_id != -1)
message["ticket_id"] = ticket_id
// send it immediately
SSchat.send_immediate(target, message)
@@ -48,7 +50,7 @@
* AVOID_HIGHLIGHTING: Unused
* trailing_newline, confidential, and handle_whitespace currently have no effect, please fix this in the future or remove the arguments to lower cache!
*/
/proc/to_chat(target, html, type, text, avoid_highlighting, handle_whitespace = TRUE, trailing_newline = TRUE, confidential = FALSE)
/proc/to_chat(target, html, type, text, avoid_highlighting, handle_whitespace = TRUE, trailing_newline = TRUE, confidential = FALSE, ticket_id = -1)
if(Master.current_runlevel == RUNLEVEL_INIT || !SSchat?.initialized)
to_chat_immediate(target, html, type, text)
return
@@ -74,4 +76,6 @@
message["html"] = html
if(avoid_highlighting)
message["avoidHighlighting"] = avoid_highlighting
if(ticket_id != -1)
message["ticket_id"] = ticket_id
SSchat.queue(target, message)