@@ -63,6 +63,11 @@ def __init__(self, response, token):
6363 self .access = token_instance (response ["access_token" ], token )
6464 self .expires = response ["expires_in" ]
6565 self .refresh_token = response ["refresh_token" ]
66+
67+ try : self .webhook = response ["webhook" ]
68+ except (KeyError ): self .webhook = None
69+ try : self .guild = response ["guild" ]
70+ except (KeyError ): self .guild = None
6671
6772class discordOauth2 ():
6873 def __init__ (self , client , secret , redirect , token = None ):
@@ -80,6 +85,7 @@ def exchange_code(self, token):
8085 'redirect_uri' : self .redirect
8186 })
8287 if response .status_code == 429 : raise Exception (f"You are being Rate Limited" )
88+ elif response .status_code != 200 : raise Exception (f"Something went wrong. Status Code: { response .status_code } " )
8389 return access_token (response .json (), self .token )
8490
8591 def refresh_token (self , refresh_token ):
@@ -90,4 +96,5 @@ def refresh_token(self, refresh_token):
9096 'refresh_token' : refresh_token
9197 })
9298 if response .status_code == 429 : raise Exception (f"You are being Rate Limited" )
99+ elif response .status_code != 200 : raise Exception (f"Something went wrong. Status Code: { response .status_code } " )
93100 return access_token (response .json (), self .token )
0 commit comments