From d518f6cded40d9bda5cfe6006b8d9ea1404c261f Mon Sep 17 00:00:00 2001 From: Techbot121 Date: Mon, 6 Jan 2025 12:52:19 +0100 Subject: [PATCH] reset nick back to default if it's the same --- app/services/discord/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/services/discord/index.ts b/app/services/discord/index.ts index 7c9829e..cc1605b 100644 --- a/app/services/discord/index.ts +++ b/app/services/discord/index.ts @@ -145,10 +145,12 @@ export class DiscordBot extends Service { ): Promise { if (!this.ready || name.length > 22) return false; try { - const nick = name.charAt(0).toUpperCase() + name.slice(1); - this.data.lastDiscordNickName = this.getNickname() ?? "Meta"; + let newNick = name.charAt(0).toUpperCase() + name.slice(1); + const currentNick = this.getNickname(); + this.data.lastDiscordNickName = currentNick ?? "Meta"; + if (currentNick === newNick) newNick = "Meta"; await this.data.save(); - await this.getGuild()?.members.me?.setNickname(nick + " Construct", reason); + await this.getGuild()?.members.me?.setNickname(newNick + " Construct", reason); return true; } catch { return false;