Skip to content

Commit 1855587

Browse files
Techbot121Meta Construct
authored andcommitted
save empty banner and remove it if there is none
1 parent 874eee9 commit 1855587

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/services/discord/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,16 @@ export class DiscordBot extends Service {
174174
const guild = this.getGuild();
175175
if (!guild) return false;
176176

177+
let banner = "";
177178
const bannerURL = guild.bannerURL({ size: 4096 });
178179
if (bannerURL) {
179180
const bannerBase64 = await getAsBase64(bannerURL);
180-
this.data.lastDiscordBanner = bannerBase64 ?? this.data.lastDiscordBanner;
181-
await this.data.save();
181+
banner = bannerBase64 ?? "";
182182
}
183+
this.data.lastDiscordBanner = banner ?? this.data.lastDiscordBanner;
184+
await this.data.save();
183185

184-
await guild.setBanner(url, reason);
186+
await guild.setBanner(url === "" ? null : url, reason);
185187
return true;
186188
} catch {
187189
return false;

0 commit comments

Comments
 (0)