Skip to content

Commit

Permalink
fix potential nickname dementia
Browse files Browse the repository at this point in the history
  • Loading branch information
Techbot121 authored and Meta Construct committed Dec 1, 2024
1 parent f111ed9 commit 906305b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/services/discord/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ export class DiscordBot extends Service {
return true;
}

async getNickname(): Promise<string | undefined> {
if (!this.ready || !this.discord.user) return;
return (await this.getGuildMember(this.discord.user.id))?.nickname?.split(" ")[0];
}

async setServerBanner(url: string): Promise<void> {
if (!this.ready || !(await this.overLvl2())) return;
const guild = this.getGuild();
Expand Down
1 change: 1 addition & 0 deletions app/services/discord/modules/discord-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default (bot: DiscordBot): void => {
const path = join(iconsPath, `${icon}.png`);
await event.guild?.setIcon(path);
await bot.discord.user?.setAvatar(path);
data.lastDiscordNickName = (await bot.getNickname()) ?? "Meta";
await bot.setNickname(
nicks[(Math.random() * nicks.length) | 0],
event.name
Expand Down

0 comments on commit 906305b

Please sign in to comment.