File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
packages/discord.js/src/structures Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -54,12 +54,14 @@ class ClientUser extends User {
54
54
* @param {ClientUserEditOptions } options The options to provide
55
55
* @returns {Promise<ClientUser> }
56
56
*/
57
- async edit ( options ) {
58
- if ( options . avatar !== undefined ) options . avatar = await DataResolver . resolveImage ( options . avatar ) ;
59
- const newData = await this . client . rest . patch ( Routes . user ( ) , { body : options } ) ;
60
- this . client . token = newData . token ;
61
- this . client . rest . setToken ( newData . token ) ;
62
- const { updated } = this . client . actions . UserUpdate . handle ( newData ) ;
57
+ async edit ( { username, avatar } ) {
58
+ const data = await this . client . rest . patch ( Routes . user ( ) , {
59
+ body : { username, avatar : avatar && ( await DataResolver . resolveImage ( avatar ) ) } ,
60
+ } ) ;
61
+
62
+ this . client . token = data . token ;
63
+ this . client . rest . setToken ( data . token ) ;
64
+ const { updated } = this . client . actions . UserUpdate . handle ( data ) ;
63
65
return updated ?? this ;
64
66
}
65
67
You can’t perform that action at this time.
0 commit comments