diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-14 21:43:24 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-14 21:43:24 -0400 |
commit | 82b7fdf99ba4ad50ca037ff11c8fd2d386c45e71 (patch) | |
tree | 87c9815a60c64503af623b20bc42e814ef4a73c4 /src/lib/common | |
parent | 0c45d2739fafd1f7b93c2a826a00a81356be0c71 (diff) | |
download | tanzanite-82b7fdf99ba4ad50ca037ff11c8fd2d386c45e71.tar.gz tanzanite-82b7fdf99ba4ad50ca037ff11c8fd2d386c45e71.tar.bz2 tanzanite-82b7fdf99ba4ad50ca037ff11c8fd2d386c45e71.zip |
add mylogs command - view your own modlogs
Diffstat (limited to 'src/lib/common')
-rw-r--r-- | src/lib/common/HighlightManager.ts | 4 | ||||
-rw-r--r-- | src/lib/common/util/Format.ts | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/common/HighlightManager.ts b/src/lib/common/HighlightManager.ts index a3c1813..4f891b7 100644 --- a/src/lib/common/HighlightManager.ts +++ b/src/lib/common/HighlightManager.ts @@ -11,7 +11,7 @@ import { type TextBasedChannel } from 'discord.js'; import { colors, Time } from '../utils/BushConstants.js'; -import { escapeMarkdown, sanitizeWtlAndControl } from './util/Format.js'; +import { sanitizeInputForDiscord } from './util/Format.js'; const NOTIFY_COOLDOWN = 5 * Time.Minute; const OWNER_NOTIFY_COOLDOWN = 5 * Time.Minute; @@ -451,7 +451,7 @@ export class HighlightManager { author: { name: hl.regex ? `/${hl.word}/gi` : hl.word }, fields: [{ name: 'Source message', value: `[Jump to message](${message.url})` }], color: colors.default, - footer: { text: `Triggered in ${escapeMarkdown(sanitizeWtlAndControl(`${message.guild}`))}` }, + footer: { text: `Triggered in ${sanitizeInputForDiscord(`${message.guild}`)}` }, timestamp: message.createdAt.toISOString() }; } diff --git a/src/lib/common/util/Format.ts b/src/lib/common/util/Format.ts index ff34745..debaf4b 100644 --- a/src/lib/common/util/Format.ts +++ b/src/lib/common/util/Format.ts @@ -88,7 +88,7 @@ export function spoiler(content: string): string { * @param text The input */ export function input(text: string): string { - return bold(escapeMarkdown(sanitizeWtlAndControl(`${text}`))); + return bold(sanitizeInputForDiscord(`${text}`)); } /** @@ -108,4 +108,12 @@ export function sanitizeWtlAndControl(str: string) { return `${str}`.replace(/[\u0000-\u001F\u007F-\u009F\u200B]/g, ''); } +/** + * Removed wtl and control characters and escapes any other markdown + * @param text The input + */ +export function sanitizeInputForDiscord(text: string): string { + return escapeMarkdown(sanitizeWtlAndControl(`${text}`)); +} + export { escapeMarkdown } from 'discord.js'; |