@@ -63,6 +63,11 @@ def __init__(self, response, token):
63
63
self .access = token_instance (response ["access_token" ], token )
64
64
self .expires = response ["expires_in" ]
65
65
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
66
71
67
72
class discordOauth2 ():
68
73
def __init__ (self , client , secret , redirect , token = None ):
@@ -80,6 +85,7 @@ def exchange_code(self, token):
80
85
'redirect_uri' : self .redirect
81
86
})
82
87
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 } " )
83
89
return access_token (response .json (), self .token )
84
90
85
91
def refresh_token (self , refresh_token ):
@@ -90,4 +96,5 @@ def refresh_token(self, refresh_token):
90
96
'refresh_token' : refresh_token
91
97
})
92
98
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 } " )
93
100
return access_token (response .json (), self .token )
0 commit comments