Skip to content

Conversation

@Lumabots
Copy link
Contributor

@Lumabots Lumabots commented Nov 7, 2025

Introduces the AppInfo.edit coroutine to allow editing application settings. Updates AppInfo and related types to support new fields such as bot, flags, event webhooks, integration_types_config, and approximate_user_authorization_count. Also refactors type hints and improves handling of optional fields for better API compatibility.

Summary

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

Introduces the AppInfo.edit coroutine to allow editing application settings. Updates AppInfo and related types to support new fields such as bot, flags, event webhooks, integration_types_config, and approximate_user_authorization_count. Also refactors type hints and improves handling of optional fields for better API compatibility.
@Lumabots Lumabots requested a review from a team as a code owner November 7, 2025 15:17
@pycord-app
Copy link

pycord-app bot commented Nov 7, 2025

Thanks for opening this pull request!
Please make sure you have read the Contributing Guidelines and Code of Conduct.

This pull request can be checked-out with:

git fetch origin pull/2994/head:pr-2994
git checkout pr-2994

This pull request can be installed with:

pip install git+https://github.com/Pycord-Development/pycord@refs/pull/2994/head

@Lumabots Lumabots changed the title Add support for editing application info and new fields feat: Add support for editing application info and new fields Nov 7, 2025
@Paillat-dev Paillat-dev added hold: changelog This pull request is missing a changelog entry hold: testing This pull request requires further testing priority: low Low Priority labels Nov 7, 2025
Copy link
Contributor

@Soheab Soheab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also missing docs for the new attributes.

Introduces the AppInfo.edit() method to allow editing application settings, including new and previously missing fields such as icon, cover_image, tags, install_params, integration_types_config, flags, event_webhooks_url, event_webhooks_status, and event_webhooks_types. Also adds related helper classes and properties for handling these fields and updates the CHANGELOG accordingly.
@Lumabots Lumabots requested review from a team as code owners November 7, 2025 18:00
@Lumabots Lumabots requested a review from Copilot November 7, 2025 18:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds an AppInfo.edit() method for editing application settings and includes missing fields from the Discord API to the AppInfo class.

Key Changes:

  • Added AppInfo.edit() method to modify application settings via the Discord API
  • Added new fields to AppInfo including bot, event_webhooks_*, integration_types_config, and approximate_user_authorization_count
  • Restructured TypedDict definitions in discord/types/appinfo.py to better reflect the Discord API structure
  • Added IntegrationTypesConfig helper class for per-installation context configuration

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
discord/types/appinfo.py Restructured TypedDict definitions, changed from User to PartialUser, moved many fields to NotRequired, and added new type aliases for application integration types
discord/http.py Added edit_current_application() HTTP method to support the new edit functionality
discord/client.py Removed workaround for missing rpc_origins field and cleaned up unused imports
discord/appinfo.py Added new edit() method, new fields and properties, IntegrationTypesConfig class, and to_payload() method for AppInstallParams
CHANGELOG.md Documented the new feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Lumabots and others added 9 commits November 7, 2025 19:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Updated the AppInfo class to only accept bytes or None for the icon and cover_image parameters, removing support for str. This change clarifies the expected types and may prevent type-related errors.
@Lumabots Lumabots requested a review from Soheab November 11, 2025 09:20
@Lumabots Lumabots removed the hold: changelog This pull request is missing a changelog entry label Nov 11, 2025
"approximate_user_authorization_count"
)
raw_flags = data.get("flags")
self._flags: int | None = raw_flags if isinstance(raw_flags, int) else None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the instance check for?

.. versionadded:: 2.7
flags: Optional[:class:`ApplicationFlags`]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a property, which means it's self-documented AFAIK.

)

@property
def flags(self) -> ApplicationFlags | None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing versionadded string

return None
return ApplicationFlags._from_value(self._flags)

async def edit(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing versionadded string

Edit the current application's settings.
This method wraps the Edit Current Application endpoint and returns the updated application info.
Copy link
Contributor

@Soheab Soheab Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

Parameters
----------
description: Optional[:class:`str`]
The new application description. Pass ``None`` to clear.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The new ... or ``None`` to clear" would be better wording, I think?

Comment on lines +241 to +244
owner_data = data.get("owner")
self.owner: User | None = (
state.create_user(owner_data) if owner_data is not None else None
)
Copy link
Contributor

@Soheab Soheab Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inconsistent with how it's done for the bot attribute below

Comment on lines -228 to +286
self.tags: list[str] | None = data.get("tags", [])
self.tags: list[str] = data.get("tags", [])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it was None because it could have a value of null? Should it maybe do or [] to be sure?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was any of this done?

Comment on lines +288 to +290
self.integration_types_config: dict[int, dict[str, object] | None] | None = (
data.get("integration_types_config")
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason the IntegrationTypesConfig object below isn't used here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold: testing This pull request requires further testing PA: Maintainers pending priority: low Low Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants