Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 80176d6

Browse files
backwards compatability for misspelt function name 'client_credentails_grant'
1 parent 6e5ad09 commit 80176d6

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

‎discordoauth2/async_oauth.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,18 @@ async def refresh_token(self, refresh_token: str) -> AsyncAccessToken:
402402
f"Unexpected HTTP {response.status}"
403403
)
404404

405+
async def client_credentails_grant(
406+
self, scope: list[str] = None
407+
) -> AsyncAccessToken:
408+
"""Creates an `AccessToken` on behalf of the application. If the owner is a team, then only `identify` and `applications.commands.update` are allowed.
409+
410+
*Identical to `client_credentials_grant` but with a typo for backwards compatibility.*
411+
412+
scope: list of string scopes to authorize.
413+
"""
414+
415+
return await self.client_credentials_grant(scope)
416+
405417
async def client_credentials_grant(
406418
self, scope: list[str]
407419
) -> AsyncAccessToken:
@@ -495,5 +507,7 @@ def generate_uri(
495507
"permissions": permissions,
496508
}
497509
if "applications.commands" in scope:
498-
params["integration_type"] = 0 if integration_type == "guild" else 1
510+
params["integration_type"] = (
511+
0 if integration_type == "guild" else 1
512+
)
499513
return f"https://discord.com/oauth2/authorize?{parse.urlencode({key: value for key, value in params.items() if value is not None})}"

‎discordoauth2/sync_oauth.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,16 @@ def refresh_token(self, refresh_token: str) -> AccessToken:
376376
f"Unexpected HTTP {response.status_code}"
377377
)
378378

379+
def client_credentails_grant(self, scope: list[str] = None) -> AccessToken:
380+
"""Creates an `AccessToken` on behalf of the application. If the owner is a team, then only `identify` and `applications.commands.update` are allowed.
381+
382+
*Identical to `client_credentials_grant` but with a typo for backwards compatibility.*
383+
384+
scope: list of string scopes to authorize.
385+
"""
386+
387+
return self.client_credentials_grant(scope)
388+
379389
def client_credentials_grant(self, scope: list[str]) -> AccessToken:
380390
"""Creates an `AccessToken` on behalf of the application's owner. If the owner is a team, then only `identify` and `applications.commands.update` are allowed.
381391
@@ -466,5 +476,7 @@ def generate_uri(
466476
"permissions": permissions,
467477
}
468478
if "applications.commands" in scope:
469-
params["integration_type"] = 0 if integration_type == "guild" else 1
479+
params["integration_type"] = (
480+
0 if integration_type == "guild" else 1
481+
)
470482
return f"https://discord.com/oauth2/authorize?{parse.urlencode({key: value for key, value in params.items() if value is not None})}"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /