@@ -13,6 +13,7 @@ import {
13
13
invitejson ,
14
14
rolesjson ,
15
15
emojipjson ,
16
+ extendedProperties ,
16
17
} from "./jsontypes.js" ;
17
18
import { User } from "./user.js" ;
18
19
import { I18n } from "./i18n.js" ;
@@ -433,6 +434,17 @@ class Guild extends SnowFlake {
433
434
this . roleUpdate ( role , - 1 ) ;
434
435
}
435
436
onEmojiUpdate = ( _ : emojipjson [ ] ) => { } ;
437
+ update ( json : extendedProperties ) {
438
+ this . large = json . large ;
439
+ this . member_count = json . member_count ;
440
+ this . emojis = json . emojis ;
441
+ this . headers = this . owner . headers ;
442
+ this . channels = [ ] ;
443
+
444
+ this . roles = [ ] ;
445
+ this . roleids = new Map ( ) ;
446
+ this . banner = json . banner ;
447
+ }
436
448
constructor ( json : guildjson | - 1 , owner : Localuser , member : memberjson | User | null ) {
437
449
if ( json === - 1 || member === null ) {
438
450
super ( "@me" ) ;
@@ -442,22 +454,28 @@ class Guild extends SnowFlake {
442
454
console . log ( json . stickers , ":3" ) ;
443
455
}
444
456
super ( json . id ) ;
457
+ this . owner = owner ;
445
458
this . large = json . large ;
446
459
this . member_count = json . member_count ;
447
460
this . emojis = json . emojis ;
448
- this . owner = owner ;
449
461
this . headers = this . owner . headers ;
450
462
this . channels = [ ] ;
451
- this . properties = json . properties ;
463
+ if ( json . properties ) {
464
+ this . properties = json . properties ;
465
+ }
452
466
this . roles = [ ] ;
453
467
this . roleids = new Map ( ) ;
468
+ this . banner = json . properties . banner ;
469
+ if ( json . roles ) {
470
+ for ( const roley of json . roles ) {
471
+ const roleh = new Role ( roley , this ) ;
472
+ this . roles . push ( roleh ) ;
473
+ this . roleids . set ( roleh . id , roleh ) ;
474
+ }
475
+ }
454
476
455
477
this . message_notifications = 0 ;
456
- for ( const roley of json . roles ) {
457
- const roleh = new Role ( roley , this ) ;
458
- this . roles . push ( roleh ) ;
459
- this . roleids . set ( roleh . id , roleh ) ;
460
- }
478
+
461
479
this . sortRoles ( ) ;
462
480
if ( member instanceof User ) {
463
481
console . warn ( member ) ;
0 commit comments