Skip to content
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

feat: add support for editing our own application information #1237

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

onerandomusername
Copy link
Member

Summary

closes #1172

Implements PATCH /applications/@me

https://discord.com/developers/docs/resources/application#edit-current-application

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running pdm lint
    • I have type-checked the code by running pdm pyright
  • 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, ...)

@onerandomusername onerandomusername added t: enhancement New feature t: api support Support of Discord API features s: needs review Issue/PR is awaiting reviews labels Sep 24, 2024
@onerandomusername onerandomusername added this to the disnake v2.10 milestone Sep 24, 2024
@onerandomusername onerandomusername force-pushed the arielle/edit-app-info branch 3 times, most recently from 08019ab to a2bf13f Compare September 24, 2024 06:36
Comment on lines +294 to +302
description: Optional[str] = MISSING,
flags: ApplicationFlags = MISSING,
icon: Optional[AssetBytes] = MISSING,
cover_image: Optional[AssetBytes] = MISSING,
custom_install_url: Optional[str] = MISSING,
install_params: Optional[InstallParams] = MISSING,
role_connections_verification_url: Optional[str] = MISSING,
interactions_endpoint_url: Optional[str] = MISSING,
tags: Optional[List[str]] = MISSING,
Copy link
Member

Choose a reason for hiding this comment

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

Figured this is worth mentioning - most of these fields, other than icon and cover_image, aren't marked as nullable in the documentation.
However considering that they are optional in the application object structure itself, clearly only setting them to null would reset the fields. So I assume this is fine?

Comment on lines +309 to +310

Returns a new :class:`AppInfo` with the updated information.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Returns a new :class:`AppInfo` with the updated information.

description: Optional[:class:`str`]
The application's description.
flags: Optional[:class:`ApplicationFlags`]
The application's public flags.
Copy link
Member

Choose a reason for hiding this comment

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

should note that this is limited to specific flags only

icon: |resource_type|
Update the application's icon asset, if any.
cover_image: |resource_type|
Retrieves the cover image on a store embed, if any.
Copy link
Member

Choose a reason for hiding this comment

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

this description is outdated


.. versionadded:: 2.10

Parameters
Copy link
Member

Choose a reason for hiding this comment

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

the docstring is missing interactions_endpoint_url

Raises
------
HTTPException
Editing the information failed somehow.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Editing the information failed somehow.
Editing the application information failed.

@@ -2372,6 +2372,93 @@ async def application_info(self) -> AppInfo:
data["rpc_origins"] = None
return AppInfo(self._connection, data)

async def edit_application_info(
Copy link
Member

Choose a reason for hiding this comment

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

Having the same method on Client seems unnecessary (also not very DRY code :<).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: needs review Issue/PR is awaiting reviews t: api support Support of Discord API features t: enhancement New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the ability to change the description of the bot
2 participants