Skip to content

Commit 6abdeea

Browse files
Techbot121Meta Construct
authored andcommitted
reset icon if no path is specified instead of using the last
1 parent d38902d commit 6abdeea

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

app/services/discord/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Container } from "@/app/Container";
22
import { Data, GameBridge, Service } from "@/app/services";
33
import { getAsBase64 } from "@/utils";
4+
import { getEventIcon } from "./modules/discord-guild-icon";
45
import Discord from "discord.js";
56
import DiscordConfig from "@/config/discord.json";
67
import modules from "./modules";
@@ -118,14 +119,16 @@ export class DiscordBot extends Service {
118119
}
119120

120121
// sets both the bot's avatar and the guild's icon
121-
async setIcon(
122-
path = this.data.lastDiscordGuildIcon ?? "resources/discord-guild-icons/default.png",
123-
reason?: string
124-
): Promise<boolean> {
122+
async setIcon(path?: string, reason?: string): Promise<boolean> {
125123
if (!this.ready || !this.discord.user) return false;
126124
try {
127125
const guild = this.getGuild();
128126
if (!guild) return false;
127+
128+
if (!path) {
129+
path = (await getEventIcon()).filePath;
130+
}
131+
129132
const iconURL = this.discord.user.avatarURL() ?? guild.iconURL();
130133
this.data.lastDiscordGuildIcon = iconURL
131134
? (await getAsBase64(iconURL)) ?? this.data.lastDiscordGuildIcon

0 commit comments

Comments
 (0)