From 72f4648ff96e5244dbd73dfe5bd336c1546488b8 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 28 Jul 2023 07:45:06 +0200 Subject: [PATCH] Do not add bot's nickname if it's the bot user --- src/toOpenAIMessages.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/toOpenAIMessages.ts b/src/toOpenAIMessages.ts index f81c32f..b0f2ea9 100644 --- a/src/toOpenAIMessages.ts +++ b/src/toOpenAIMessages.ts @@ -81,7 +81,8 @@ function formatName(name: string): string { * @param message the message to get the author name * @returns the proper author name of the message */ -function getAuthorUsername(message: DiscordMessage): string { +function getAuthorUsername(message: DiscordMessage): string | undefined { + if (message.author.id === message.client.user.id ) return undefined; if (message.member) { const name = formatName(message.member.displayName); if (name.length >= 3) return name;