Skip to content

Commit

Permalink
reset nick back to default if it's the same
Browse files Browse the repository at this point in the history
  • Loading branch information
Techbot121 authored and Meta Construct committed Jan 6, 2025
1 parent 255a331 commit d518f6c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/services/discord/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,12 @@ export class DiscordBot extends Service {
): Promise<boolean> {
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;
Expand Down

0 comments on commit d518f6c

Please sign in to comment.