Do not add bot's nickname if it's the bot user

This commit is contained in:
Wroclaw 2023-07-28 07:45:06 +02:00
parent f9097ae68d
commit 72f4648ff9

View file

@ -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;