File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 11import { Container } from "@/app/Container" ;
22import { Data , GameBridge , Service } from "@/app/services" ;
33import { getAsBase64 } from "@/utils" ;
4+ import { getEventIcon } from "./modules/discord-guild-icon" ;
45import Discord from "discord.js" ;
56import DiscordConfig from "@/config/discord.json" ;
67import 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
You can’t perform that action at this time.
0 commit comments