Tidy up edit/deletion styles
parent
6a8ecfed8a
commit
adc54909fa
|
@ -119,15 +119,32 @@ const defaultFormatters = {
|
|||
},
|
||||
|
||||
formatStaffReplyEditNotificationThreadMessage(threadMessage, newText, moderator) {
|
||||
let content = `**${moderator.user.username}#${moderator.user.discriminator}** (\`${moderator.id}\`) edited reply \`[${threadMessage.message_number}]\`:`;
|
||||
content += `\n\nBefore:\n\`\`\`${utils.disableCodeBlocks(threadMessage.body)}\`\`\``;
|
||||
content += `\nAfter:\n\`\`\`${utils.disableCodeBlocks(newText)}\`\`\``;
|
||||
let content = `**${moderator.user.username}#${moderator.user.discriminator}** (\`${moderator.id}\`) edited reply \`${threadMessage.message_number}\``;
|
||||
|
||||
if (threadMessage.body.length < 200 && newText.length < 200) {
|
||||
// Show edits of small messages inline
|
||||
content += ` from \`${utils.disableInlineCode(threadMessage.body)}\` to \`${newText}\``;
|
||||
} else {
|
||||
// Show edits of long messages in two code blocks
|
||||
content += ":";
|
||||
content += `\n\nBefore:\n\`\`\`${utils.disableCodeBlocks(threadMessage.body)}\`\`\``;
|
||||
content += `\nAfter:\n\`\`\`${utils.disableCodeBlocks(newText)}\`\`\``;
|
||||
}
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
formatStaffReplyDeletionNotificationThreadMessage(threadMessage, moderator) {
|
||||
let content = `**${moderator.user.username}#${moderator.user.discriminator}** (\`${moderator.id}\`) deleted reply \`[${threadMessage.message_number}]\`:`;
|
||||
content += "```" + utils.disableCodeBlocks(threadMessage.body) + "```";
|
||||
let content = `**${moderator.user.username}#${moderator.user.discriminator}** (\`${moderator.id}\`) deleted reply \`[${threadMessage.message_number}]\``;
|
||||
|
||||
if (threadMessage.body.length < 200) {
|
||||
// Show the original content of deleted small messages inline
|
||||
content += ` (message content: \`${utils.disableInlineCode(threadMessage.body)}\`)`;
|
||||
} else {
|
||||
// Show the original content of deleted large messages in a code block
|
||||
content += ":\n```" + utils.disableCodeBlocks(threadMessage.body) + "```";
|
||||
}
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
|
|
|
@ -306,6 +306,10 @@ function escapeMarkdown(str) {
|
|||
return str.replace(markdownCharsRegex, "\\$1");
|
||||
}
|
||||
|
||||
function disableInlineCode(str) {
|
||||
return str.replace(/`/g, "'");
|
||||
}
|
||||
|
||||
function disableCodeBlocks(str) {
|
||||
return str.replace(/`/g, "`\u200b");
|
||||
}
|
||||
|
@ -351,6 +355,7 @@ module.exports = {
|
|||
humanizeDelay,
|
||||
|
||||
escapeMarkdown,
|
||||
disableInlineCode,
|
||||
disableCodeBlocks,
|
||||
|
||||
readMultilineConfigValue,
|
||||
|
|
Loading…
Reference in New Issue