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 1
1
import { Container } from "@/app/Container" ;
2
2
import { Data , GameBridge , Service } from "@/app/services" ;
3
3
import { getAsBase64 } from "@/utils" ;
4
+ import { getEventIcon } from "./modules/discord-guild-icon" ;
4
5
import Discord from "discord.js" ;
5
6
import DiscordConfig from "@/config/discord.json" ;
6
7
import modules from "./modules" ;
@@ -118,14 +119,16 @@ export class DiscordBot extends Service {
118
119
}
119
120
120
121
// 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 > {
125
123
if ( ! this . ready || ! this . discord . user ) return false ;
126
124
try {
127
125
const guild = this . getGuild ( ) ;
128
126
if ( ! guild ) return false ;
127
+
128
+ if ( ! path ) {
129
+ path = ( await getEventIcon ( ) ) . filePath ;
130
+ }
131
+
129
132
const iconURL = this . discord . user . avatarURL ( ) ?? guild . iconURL ( ) ;
130
133
this . data . lastDiscordGuildIcon = iconURL
131
134
? ( await getAsBase64 ( iconURL ) ) ?? this . data . lastDiscordGuildIcon
You can’t perform that action at this time.
0 commit comments