File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,20 @@ export default (options) => {
7
7
scope : 'identify email' ,
8
8
params : { grant_type : 'authorization_code' } ,
9
9
accessTokenUrl : 'https://discord.com/api/oauth2/token' ,
10
- authorizationUrl :
11
- 'https://discord.com/api/oauth2/authorize?response_type=code&prompt=none' ,
10
+ authorizationUrl : 'https://discord.com/api/oauth2/authorize?response_type=code&prompt=none' ,
12
11
profileUrl : 'https://discord.com/api/users/@me' ,
13
12
profile : ( profile ) => {
13
+ if ( profile . avatar === null ) {
14
+ const defaultAvatarNumber = parseInt ( profile . discriminator ) % 5
15
+ profile . image_url = `https://cdn.discordapp.com/embed/avatars/${ defaultAvatarNumber } .png`
16
+ } else {
17
+ const format = profile . premium_type === 1 || profile . premium_type === 2 ? 'gif' : 'png'
18
+ profile . image_url = `https://cdn.discordapp.com/avatars/${ profile . id } /${ profile . avatar } .${ format } `
19
+ }
14
20
return {
15
21
id : profile . id ,
16
22
name : profile . username ,
17
- image : `https://cdn.discordapp.com/avatars/ ${ profile . id } / ${ profile . avatar } .png` ,
23
+ image : profile . image_url ,
18
24
email : profile . email
19
25
}
20
26
} ,
You can’t perform that action at this time.
0 commit comments