Add dtext to markdown for tickets and appeals
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import { formatMarkdown, parseDTextToAST } from '@clynamic/dmark';
|
||||
|
||||
export function dtextToMarkdown(dtext: string): string {
|
||||
return formatMarkdown(parseDTextToAST(dtext)).output;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { APIEmbedField, EmbedAuthorOptions } from 'discord.js';
|
||||
import { config } from '../config';
|
||||
import { getE621Post, PostAction, spoilerOrBlacklist } from './e621-utils';
|
||||
import { appealIDRegex, blipIDRegex, commentIDRegex, flagIDRegex, forumTopicIDRegex, poolIDRegex, postIDRegex, recordIDRegex, searchLinkRegex, setIDRegex, takedownIDRegex, ticketIDRegex, userIDRegex, wikiLinkRegex } from './message-matcher-regex';
|
||||
import { dtextToMarkdown } from './dtext-utils';
|
||||
|
||||
// TODO: Condense this and the message event handler regex array.
|
||||
const linkReplacers = [
|
||||
@@ -134,7 +135,7 @@ export async function getLinks(input: string, limit: number = Number.MAX_SAFE_IN
|
||||
}
|
||||
|
||||
export async function getDescription(data: { reason: string }): Promise<string> {
|
||||
return data.reason.length <= MAX_DESCRIPTION_LENGTH ? await getLinks(data.reason) : await getLinks(data.reason, MAX_DESCRIPTION_LENGTH);
|
||||
return dtextToMarkdown(data.reason.length <= MAX_DESCRIPTION_LENGTH ? await getLinks(data.reason) : await getLinks(data.reason, MAX_DESCRIPTION_LENGTH));
|
||||
}
|
||||
|
||||
export function getAuthor(data: { user_id: number, user: string }): EmbedAuthorOptions {
|
||||
|
||||
+3
-1
@@ -8,9 +8,11 @@ export * from './channel-utils';
|
||||
export * from './commands';
|
||||
export * from './debug-utils';
|
||||
export * from './discord-user-utils';
|
||||
export * from './embed-utils';
|
||||
export * from './dtext-utils';
|
||||
export * from './e621-utils';
|
||||
export * from './embed-utils';
|
||||
export * from './event-log-utils';
|
||||
export * from './event-utils';
|
||||
export * from './file-utils';
|
||||
export * from './github-user-utils';
|
||||
export * from './interaction-utils';
|
||||
|
||||
Reference in New Issue
Block a user