@@ -122,6 +122,20 @@ class GuildMember extends Base {
122
122
} else {
123
123
this . flags ??= new GuildMemberFlagsBitField ( ) . freeze ( ) ;
124
124
}
125
+
126
+ if ( data . avatar_decoration_data ) {
127
+ /**
128
+ * The member avatar decoration's data
129
+ *
130
+ * @type {?AvatarDecorationData }
131
+ */
132
+ this . avatarDecorationData = {
133
+ asset : data . avatar_decoration_data . asset ,
134
+ skuId : data . avatar_decoration_data . sku_id ,
135
+ } ;
136
+ } else {
137
+ this . avatarDecorationData = null ;
138
+ }
125
139
}
126
140
127
141
_clone ( ) {
@@ -166,6 +180,15 @@ class GuildMember extends Base {
166
180
return this . avatar && this . client . rest . cdn . guildMemberAvatar ( this . guild . id , this . id , this . avatar , options ) ;
167
181
}
168
182
183
+ /**
184
+ * A link to the member's avatar decoration.
185
+ *
186
+ * @returns {?string }
187
+ */
188
+ avatarDecorationURL ( ) {
189
+ return this . avatarDecorationData ? this . client . rest . cdn . avatarDecoration ( this . avatarDecorationData . asset ) : null ;
190
+ }
191
+
169
192
/**
170
193
* A link to the member's banner.
171
194
* @param {ImageURLOptions } [options={}] Options for the banner URL
@@ -195,6 +218,16 @@ class GuildMember extends Base {
195
218
return this . bannerURL ( options ) ?? this . user . bannerURL ( options ) ;
196
219
}
197
220
221
+ /**
222
+ * A link to the member's guild avatar decoration if they have one.
223
+ * Otherwise, a link to their {@link User#avatarDecorationURL} will be returned.
224
+ *
225
+ * @returns {?string }
226
+ */
227
+ displayAvatarDecorationURL ( ) {
228
+ return this . avatarDecorationURL ( ) ?? this . user . avatarDecorationURL ( ) ;
229
+ }
230
+
198
231
/**
199
232
* The time this member joined the guild
200
233
* @type {?Date }
@@ -499,7 +532,10 @@ class GuildMember extends Base {
499
532
this . communicationDisabledUntilTimestamp === member . communicationDisabledUntilTimestamp &&
500
533
this . flags . bitfield === member . flags . bitfield &&
501
534
( this . _roles === member . _roles ||
502
- ( this . _roles . length === member . _roles . length && this . _roles . every ( ( role , i ) => role === member . _roles [ i ] ) ) )
535
+ ( this . _roles . length === member . _roles . length &&
536
+ this . _roles . every ( ( role , index ) => role === member . _roles [ index ] ) ) ) &&
537
+ this . avatarDecorationData ?. asset === member . avatarDecorationData ?. asset &&
538
+ this . avatarDecorationData ?. skuId === member . avatarDecorationData ?. skuId
503
539
) ;
504
540
}
505
541
@@ -525,6 +561,7 @@ class GuildMember extends Base {
525
561
json . bannerURL = this . bannerURL ( ) ;
526
562
json . displayAvatarURL = this . displayAvatarURL ( ) ;
527
563
json . displayBannerURL = this . displayBannerURL ( ) ;
564
+ json . avatarDecorationURL = this . avatarDecorationURL ( ) ;
528
565
return json ;
529
566
}
530
567
}
0 commit comments