File tree 3 files changed +14
-4
lines changed
3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -440,8 +440,14 @@ class Guild extends SnowFlake {
440
440
this . emojis = json . emojis ;
441
441
this . headers = this . owner . headers ;
442
442
this . channels = [ ] ;
443
-
444
- this . roles = [ ] ;
443
+ if ( this . properties . icon !== json . icon ) {
444
+ this . properties . icon = json . icon ;
445
+ if ( this . HTMLicon ) {
446
+ const divy = this . generateGuildIcon ( ) ;
447
+ this . HTMLicon . replaceWith ( divy ) ;
448
+ this . HTMLicon = divy ;
449
+ }
450
+ }
445
451
this . roleids = new Map ( ) ;
446
452
this . banner = json . banner ;
447
453
}
@@ -666,6 +672,7 @@ class Guild extends SnowFlake {
666
672
return a . position - b . position ;
667
673
} ) ;
668
674
}
675
+ HTMLicon ?: HTMLElement ;
669
676
static generateGuildIcon ( guild : Guild | ( invitejson [ "guild" ] & { info : { cdn : string } } ) ) {
670
677
const divy = document . createElement ( "div" ) ;
671
678
divy . classList . add ( "servernoti" ) ;
Original file line number Diff line number Diff line change @@ -490,8 +490,10 @@ class Localuser {
490
490
const guildy = new Guild ( temp . d , this , this . user ) ;
491
491
this . guilds . push ( guildy ) ;
492
492
this . guildids . set ( guildy . id , guildy ) ;
493
+ const divy = guildy . generateGuildIcon ( ) ;
494
+ guildy . HTMLicon = divy ;
493
495
( document . getElementById ( "servers" ) as HTMLDivElement ) . insertBefore (
494
- guildy . generateGuildIcon ( ) ,
496
+ divy ,
495
497
document . getElementById ( "bottomseparator" ) ,
496
498
) ;
497
499
} ) ( ) ;
@@ -966,6 +968,7 @@ class Localuser {
966
968
continue ;
967
969
}
968
970
const divy = thing . generateGuildIcon ( ) ;
971
+ thing . HTMLicon = divy ;
969
972
serverlist . append ( divy ) ;
970
973
}
971
974
{
Original file line number Diff line number Diff line change @@ -387,7 +387,7 @@ class Member extends SnowFlake {
387
387
}
388
388
static async resolveMember ( user : User , guild : Guild ) : Promise < Member | undefined > {
389
389
const maybe = user . members . get ( guild ) ;
390
- if ( ! user . members . has ( guild ) ) {
390
+ if ( ! maybe ) {
391
391
const membpromise = guild . localuser . resolvemember ( user . id , guild . id ) ;
392
392
const promise = new Promise < Member | undefined > ( async ( res ) => {
393
393
const membjson = await membpromise ;
You can’t perform that action at this time.
0 commit comments