add fallbacks

This commit is contained in:
MathMan05 2025-04-11 14:57:13 -05:00
parent dcc94f28ff
commit 8fa9c06e72
2 changed files with 4 additions and 3 deletions

View file

@ -129,6 +129,7 @@ class Emoji {
} }
} }
for (const guild of localuser.guilds) { for (const guild of localuser.guilds) {
if (!guild.emojis) continue;
const emj = guild.emojis.find((_) => _.id === idOrString); const emj = guild.emojis.find((_) => _.id === idOrString);
if (emj) { if (emj) {
return new Emoji(emj, localuser); return new Emoji(emj, localuser);

View file

@ -643,7 +643,7 @@ class Guild extends SnowFlake {
update(json: extendedProperties) { update(json: extendedProperties) {
this.large = json.large; this.large = json.large;
this.member_count = json.member_count; this.member_count = json.member_count;
this.emojis = json.emojis; this.emojis = json.emojis || [];
this.headers = this.owner.headers; this.headers = this.owner.headers;
this.properties.features = json.features; this.properties.features = json.features;
if (this.properties.icon !== json.icon) { if (this.properties.icon !== json.icon) {
@ -669,7 +669,7 @@ class Guild extends SnowFlake {
this.owner = owner; this.owner = owner;
this.large = json.large; this.large = json.large;
this.member_count = json.member_count; this.member_count = json.member_count;
this.emojis = json.emojis; this.emojis = json.emojis || [];
this.headers = this.owner.headers; this.headers = this.owner.headers;
this.channels = []; this.channels = [];
if (json.properties) { if (json.properties) {
@ -720,7 +720,7 @@ class Guild extends SnowFlake {
} }
} }
this.prevchannel = this.localuser.channelids.get(this.perminfo.prevchannel); this.prevchannel = this.localuser.channelids.get(this.perminfo.prevchannel);
this.stickers = json.stickers.map((_) => new Sticker(_, this)); this.stickers = json.stickers.map((_) => new Sticker(_, this)) || [];
} }
get perminfo() { get perminfo() {
return this.localuser.perminfo.guilds[this.id]; return this.localuser.perminfo.guilds[this.id];