parent
5bae461211
commit
b25c524759
@ -121,6 +121,11 @@ class DiscordUser(PermissionsMixin):
|
||||
|
||||
@property
|
||||
def avatar_url(self):
|
||||
# Default avatar
|
||||
if len(self.avatar) <= 1:
|
||||
return f"https://cdn.discordapp.com/embed/avatars/{self.avatar}.png"
|
||||
|
||||
# Custom avatar
|
||||
return f"https://cdn.discordapp.com/avatars/{self.id}/{self.avatar}.webp?size=128"
|
||||
|
||||
@property
|
||||
|
@ -101,10 +101,14 @@ class DiscordLoginRedirect(View):
|
||||
url=f"{settings.DISCORD_API_URL}/users/@me",
|
||||
headers={"Authorization": f"Bearer {access_token}"}
|
||||
)
|
||||
|
||||
log.debug(response)
|
||||
|
||||
return response.json()
|
||||
data = response.json()
|
||||
|
||||
if not data.get("avatar"):
|
||||
data["avatar"] = int(data["id"]) % 5
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class Login(TemplateView):
|
||||
|
Loading…
x
Reference in New Issue
Block a user