3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-11 04:45:02 +00:00

use Util methods for escaping inline code and code blocks

This commit is contained in:
almeidx 2021-07-29 17:35:27 +01:00
parent 5e91a9fed3
commit 5de35f711d
No known key found for this signature in database
GPG key ID: 8558FBFF849BD664
11 changed files with 36 additions and 55 deletions

View file

@ -1,13 +1,7 @@
import { Util } from "discord.js";
import humanizeDuration from "humanize-duration";
import moment from "moment-timezone";
import {
createChunkedMessage,
DBDateFormat,
deactivateMentions,
disableCodeBlocks,
sorter,
trimLines,
} from "../../../utils";
import { createChunkedMessage, DBDateFormat, deactivateMentions, sorter, trimLines } from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { postCmd } from "../types";
@ -33,7 +27,7 @@ export const ScheduledPostsListCmd = postCmd({
const isTruncated = previewText.length > SCHEDULED_POST_PREVIEW_TEXT_LENGTH;
previewText = disableCodeBlocks(deactivateMentions(previewText))
previewText = Util.escapeCodeBlock(deactivateMentions(previewText))
.replace(/\s+/g, " ")
.slice(0, SCHEDULED_POST_PREVIEW_TEXT_LENGTH);
@ -61,7 +55,7 @@ export const ScheduledPostsListCmd = postCmd({
const finalMessage = trimLines(`
${postLines.join("\n")}
Use \`scheduled_posts <num>\` to view a scheduled post in full
Use \`scheduled_posts delete <num>\` to delete a scheduled post
`);