From f811a5f1bb805bfded342fa95d5ddc2037bdb553 Mon Sep 17 00:00:00 2001 From: Matheus Albino Date: Wed, 23 Oct 2024 17:33:26 -0300 Subject: [PATCH] Fix message formatting --- src/functions/attemptReplyAuthorMessage.ts | 5 +++-- src/utils/message.ts | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/functions/attemptReplyAuthorMessage.ts b/src/functions/attemptReplyAuthorMessage.ts index 4a29088..f99150e 100644 --- a/src/functions/attemptReplyAuthorMessage.ts +++ b/src/functions/attemptReplyAuthorMessage.ts @@ -1,5 +1,5 @@ import { TextChannel, type Message } from "discord.js"; -import { underline } from "../utils/message.ts"; +import { italic, underline } from "../utils/message.ts"; export default function attemptReplyAuthorMessage( authorMessage: Message, @@ -16,10 +16,11 @@ export default function attemptReplyAuthorMessage( if (!msg) return; const { id, guildId, channelId, author } = msg; + if (!author.globalName) return; const messageUrl = `https://discord.com/channels/${guildId}/${channelId}/${id}`; - replyMessage += `\n- Mensagem original ${++index} (por ${underline(author.globalName)}): ${messageUrl}`; + replyMessage += `\n- Mensagem original ${++index} (por ${italic(author.globalName)}): ${messageUrl}`; } authorMessage diff --git a/src/utils/message.ts b/src/utils/message.ts index 503969a..5cb23f9 100644 --- a/src/utils/message.ts +++ b/src/utils/message.ts @@ -27,3 +27,7 @@ export function transformMessageArrayInMap( export function underline(message: string): string { return `__${message}__`; } + +export function italic(message: string): string { + return `*${message}*`; +}