chat: Allow chatNewMessage hook to control rendering

This commit is contained in:
Richard Hansen 2021-10-25 20:44:35 -04:00
parent 2597b940f4
commit f1f4ed7c58
4 changed files with 27 additions and 6 deletions

View file

@ -132,6 +132,7 @@ exports.chat = (() => {
author: msg.userId,
text: padutils.escapeHtmlWithClickableLinks(msg.text, '_blank'),
message: msg,
rendered: null,
sticky: false,
timestamp: msg.time,
timeStr: (() => {
@ -164,7 +165,7 @@ exports.chat = (() => {
await hooks.aCallAll('chatNewMessage', ctx);
const cls = authorClass(ctx.author);
const chatMsg = $('<p>')
const chatMsg = ctx.rendered != null ? $(ctx.rendered) : $('<p>')
.attr('data-authorId', ctx.author)
.addClass(cls)
.append($('<b>').text(`${ctx.authorName}:`))