-
-
Notifications
You must be signed in to change notification settings - Fork 479
feat: Add support for editing application info and new fields #2994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
6cabb6f
2f54fe7
fab1478
bfa2940
9893239
884cd6c
41f12a2
714c68a
734b5ce
49c90b9
76eb883
bd91789
7e5ff54
6fc48da
bde7ec3
89d3011
dfb7907
9eecbfa
ab000ac
8c0dcd7
03a46e8
0b603f5
3c398cc
1b0017c
20cd5ed
ef0cb75
5f939dd
27b5b01
ae03d85
f2d461d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,10 +25,12 @@ | |||||||||||||||
|
|
||||||||||||||||
| from __future__ import annotations | ||||||||||||||||
|
|
||||||||||||||||
| from typing import TYPE_CHECKING | ||||||||||||||||
| from typing import TYPE_CHECKING, Any | ||||||||||||||||
|
|
||||||||||||||||
| from . import utils | ||||||||||||||||
| from .asset import Asset | ||||||||||||||||
| from .enums import ApplicationEventWebhookStatus, try_enum | ||||||||||||||||
| from .flags import ApplicationFlags | ||||||||||||||||
| from .permissions import Permissions | ||||||||||||||||
|
|
||||||||||||||||
| if TYPE_CHECKING: | ||||||||||||||||
|
|
@@ -44,6 +46,8 @@ | |||||||||||||||
| "AppInfo", | ||||||||||||||||
| "PartialAppInfo", | ||||||||||||||||
| "AppInstallParams", | ||||||||||||||||
| "IntegrationTypesConfig", | ||||||||||||||||
| "ApplicationEventWebhookStatus", | ||||||||||||||||
| ) | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -134,11 +138,31 @@ class AppInfo: | |||||||||||||||
|
|
||||||||||||||||
| .. versionadded:: 2.7 | ||||||||||||||||
|
|
||||||||||||||||
| install_params: Optional[List[:class:`AppInstallParams`]] | ||||||||||||||||
| install_params: Optional[:class:`AppInstallParams`] | ||||||||||||||||
| The settings for the application's default in-app authorization link, if set. | ||||||||||||||||
|
|
||||||||||||||||
| .. versionadded:: 2.7 | ||||||||||||||||
|
|
||||||||||||||||
| integration_types_config: Optional[:class:`IntegrationTypesConfig`] | ||||||||||||||||
| Per-installation context configuration for guild (``0``) and user (``1``) contexts. | ||||||||||||||||
|
|
||||||||||||||||
| .. versionadded:: 2.7 | ||||||||||||||||
|
|
||||||||||||||||
| event_webhooks_url: Optional[:class:`str`] | ||||||||||||||||
| The URL used to receive application event webhooks, if set. | ||||||||||||||||
|
|
||||||||||||||||
| .. versionadded:: 2.7 | ||||||||||||||||
|
|
||||||||||||||||
| event_webhooks_status: Optional[:class:`ApplicationEventWebhookStatus`] | ||||||||||||||||
| The status of event webhooks for the application, if set. | ||||||||||||||||
|
|
||||||||||||||||
| .. versionadded:: 2.7 | ||||||||||||||||
|
|
||||||||||||||||
| event_webhooks_types: Optional[List[:class:`str`]] | ||||||||||||||||
| List of event webhook types subscribed to, if set. | ||||||||||||||||
|
|
||||||||||||||||
| .. versionadded:: 2.7 | ||||||||||||||||
|
|
||||||||||||||||
| tags: Optional[List[:class:`str`]] | ||||||||||||||||
| The list of tags describing the content and functionality of the app, if set. | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -149,6 +173,16 @@ class AppInfo: | |||||||||||||||
| custom_install_url: Optional[:class:`str`] | ||||||||||||||||
| The default custom authorization URL for the application, if set. | ||||||||||||||||
|
|
||||||||||||||||
| .. versionadded:: 2.7 | ||||||||||||||||
|
|
||||||||||||||||
| approximate_user_authorization_count: Optional[:class:`int`] | ||||||||||||||||
| The approximate count of users who have authorized the application, if any. | ||||||||||||||||
|
|
||||||||||||||||
| .. versionadded:: 2.7 | ||||||||||||||||
|
|
||||||||||||||||
| bot: Optional[:class:`User`] | ||||||||||||||||
| The bot user associated with this application, if any. | ||||||||||||||||
|
|
||||||||||||||||
| .. versionadded:: 2.7 | ||||||||||||||||
| """ | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -161,6 +195,7 @@ class AppInfo: | |||||||||||||||
| "bot_public", | ||||||||||||||||
| "bot_require_code_grant", | ||||||||||||||||
| "owner", | ||||||||||||||||
| "bot", | ||||||||||||||||
| "_icon", | ||||||||||||||||
| "_summary", | ||||||||||||||||
| "verify_key", | ||||||||||||||||
|
|
@@ -173,9 +208,15 @@ class AppInfo: | |||||||||||||||
| "privacy_policy_url", | ||||||||||||||||
| "approximate_guild_count", | ||||||||||||||||
| "approximate_user_install_count", | ||||||||||||||||
| "approximate_user_authorization_count", | ||||||||||||||||
| "_flags", | ||||||||||||||||
| "redirect_uris", | ||||||||||||||||
| "interactions_endpoint_url", | ||||||||||||||||
| "role_connections_verification_url", | ||||||||||||||||
| "event_webhooks_url", | ||||||||||||||||
| "_event_webhooks_status", | ||||||||||||||||
| "event_webhooks_types", | ||||||||||||||||
| "integration_types_config", | ||||||||||||||||
| "install_params", | ||||||||||||||||
| "tags", | ||||||||||||||||
| "custom_install_url", | ||||||||||||||||
|
|
@@ -188,17 +229,18 @@ def __init__(self, state: ConnectionState, data: AppInfoPayload): | |||||||||||||||
| self.id: int = int(data["id"]) | ||||||||||||||||
| self.name: str = data["name"] | ||||||||||||||||
| self.description: str = data["description"] | ||||||||||||||||
| self._icon: str | None = data["icon"] | ||||||||||||||||
| self.rpc_origins: list[str] = data["rpc_origins"] | ||||||||||||||||
| self.bot_public: bool = data["bot_public"] | ||||||||||||||||
| self.bot_require_code_grant: bool = data["bot_require_code_grant"] | ||||||||||||||||
| self.owner: User = state.create_user(data["owner"]) | ||||||||||||||||
| self._icon: str | None = data.get("icon") | ||||||||||||||||
| self.rpc_origins: list[str] | None = data.get("rpc_origins") | ||||||||||||||||
| self.bot_public: bool = data.get("bot_public", False) | ||||||||||||||||
| self.bot_require_code_grant: bool = data.get("bot_require_code_grant", False) | ||||||||||||||||
| self.owner: User | None = data.get("owner") and state.create_user(data["owner"]) | ||||||||||||||||
|
|
||||||||||||||||
| team: TeamPayload | None = data.get("team") | ||||||||||||||||
| self.team: Team | None = Team(state, team) if team else None | ||||||||||||||||
|
|
||||||||||||||||
| self._summary: str = data["summary"] | ||||||||||||||||
Lumabots marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
| self.verify_key: str = data["verify_key"] | ||||||||||||||||
| self.bot: User | None = data.get("bot") and state.create_user(data["bot"]) | ||||||||||||||||
|
|
||||||||||||||||
| self.guild_id: int | None = utils._get_as_snowflake(data, "guild_id") | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -213,20 +255,31 @@ def __init__(self, state: ConnectionState, data: AppInfoPayload): | |||||||||||||||
| self.approximate_user_install_count: int | None = data.get( | ||||||||||||||||
| "approximate_user_install_count" | ||||||||||||||||
| ) | ||||||||||||||||
| self.redirect_uris: list[str] | None = data.get("redirect_uris", []) | ||||||||||||||||
| self.approximate_user_authorization_count: int | None = data.get( | ||||||||||||||||
| "approximate_user_authorization_count" | ||||||||||||||||
| ) | ||||||||||||||||
| self._flags: int | None = data.get("flags") | ||||||||||||||||
| self.redirect_uris: list[str] = data.get("redirect_uris", []) | ||||||||||||||||
| self.interactions_endpoint_url: str | None = data.get( | ||||||||||||||||
| "interactions_endpoint_url" | ||||||||||||||||
| ) | ||||||||||||||||
| self.role_connections_verification_url: str | None = data.get( | ||||||||||||||||
| "role_connections_verification_url" | ||||||||||||||||
| ) | ||||||||||||||||
|
|
||||||||||||||||
| install_params = data.get("install_params") | ||||||||||||||||
| self.install_params: AppInstallParams | None = ( | ||||||||||||||||
| AppInstallParams(install_params) if install_params else None | ||||||||||||||||
| self.event_webhooks_url: str | None = data.get("event_webhooks_url") | ||||||||||||||||
| self.event_webhooks_status: ApplicationEventWebhookStatus | None = data.get( | ||||||||||||||||
| "event_webhooks_status" | ||||||||||||||||
| ) and try_enum(ApplicationEventWebhookStatus, data["event_webhooks_status"]) | ||||||||||||||||
|
Comment on lines
+270
to
+272
|
||||||||||||||||
| self.event_webhooks_status: ApplicationEventWebhookStatus | None = data.get( | |
| "event_webhooks_status" | |
| ) and try_enum(ApplicationEventWebhookStatus, data["event_webhooks_status"]) | |
| status = data.get("event_webhooks_status") | |
| self.event_webhooks_status: ApplicationEventWebhookStatus | None = ( | |
| try_enum(ApplicationEventWebhookStatus, status) if status is not None else None | |
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont know for consistency if its better since i did like that for every var, and by doing like so we will double all var
Uh oh!
There was an error while loading. Please reload this page.