Skip to content

Commit

Permalink
set a server banner if one is set for the event
Browse files Browse the repository at this point in the history
  • Loading branch information
Techbot121 authored and Meta Construct committed Jan 3, 2025
1 parent 88a273c commit a77f568
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/services/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class Data extends Service {
name = "Data";
private dataPath = path.join(process.cwd(), "data");

lastDiscordBanner: string;
lastDiscordGuildEvent: string;
lastDiscordGuildIcon: string;
lastDiscordNickName: string;
Expand Down Expand Up @@ -36,6 +37,7 @@ export class Data extends Service {
};
} = {};
toSave = [
"lastDiscordBanner",
"lastDiscordGuildEvent",
"lastDiscordGuildIcon",
"lastDiscordNickName",
Expand Down
7 changes: 7 additions & 0 deletions app/services/discord/modules/discord-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default (bot: DiscordBot): void => {
});
}
await event.guild?.setIcon(data.lastDiscordGuildIcon);
await event.guild?.setBanner(data.lastDiscordBanner);
await bot.discord.user?.setAvatar(data.lastDiscordGuildIcon);
await bot.setNickname(data.lastDiscordNickName, event.name + " ended");
};
Expand Down Expand Up @@ -83,6 +84,12 @@ export default (bot: DiscordBot): void => {
break;
}
}
const banner = event.image;
if (banner) {
data.lastDiscordBanner = event.guild?.bannerURL() ?? data.lastDiscordBanner;
await event.guild?.setBanner(banner, "Event banner");
await data.save();
}
break;
}
case Discord.GuildScheduledEventStatus.Scheduled:
Expand Down

0 comments on commit a77f568

Please sign in to comment.