Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/1595.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update list of guild :attr:`~Guild.features`, and add administrator permission requirement to :meth:`Guild.prune_members` if the guild has the ``PRUNE_REQUIRES_ADMIN`` feature.
13 changes: 12 additions & 1 deletion disnake/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ class Guild(Hashable):
- ``DEVELOPER_SUPPORT_SERVER``: Guild is set as a support server in the app directory.
- ``DISCOVERABLE``: Guild shows up in Server Discovery.
- ``ENABLED_DISCOVERABLE_BEFORE``: Guild had Server Discovery enabled at least once.
- ``ENHANCED_ROLE_COLORS``: Guild can use gradient role colours.
- ``FEATURABLE``: Guild is able to be featured in Server Discovery.
- ``GUESTS_ENABLED``: Guild has access to guest invites.
- ``GUILD_TAGS``: Guild can set guild tags.
- ``HAS_DIRECTORY_ENTRY``: Guild is listed in a student hub.
- ``HUB``: Guild is a student hub.
- ``INVITE_SPLASH``: Guild's invite page can have a special splash.
Expand All @@ -327,6 +330,7 @@ class Guild(Hashable):
- ``PARTNERED``: Guild is a partnered server.
- ``PREVIEW_ENABLED``: Guild can be viewed before being accepted via Membership Screening.
- ``PRIVATE_THREADS``: Guild has access to create private threads (no longer has any effect).
- ``PRUNE_REQUIRES_ADMIN``: Guild requires administrator permissions to prune members.
- ``RAID_ALERTS_DISABLED``: Guild has disabled alerts for join raids in the configured safety alerts channel.
- ``ROLE_ICONS``: Guild has access to role icons.
- ``ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE``: Guild has role subscriptions that can be purchased.
Expand Down Expand Up @@ -3150,7 +3154,9 @@ async def prune_members(
``days`` number of days and they have no roles.

You must have the :attr:`~Permissions.manage_guild` and
:attr:`~Permissions.kick_members` permissions to use this.
:attr:`~Permissions.kick_members` permissions to use this;
if :attr:`Guild.features` contains ``PRUNE_REQUIRES_ADMIN``,
you must have :attr:`~Permissions.administrator` permission instead.

To check how many members you would prune without actually pruning,
see the :meth:`estimate_pruned_members` function.
Expand Down Expand Up @@ -3262,6 +3268,11 @@ async def estimate_pruned_members(self, *, days: int, roles: list[Snowflake] = M
pruning members, it returns how many members it would prune
from the guild had it been called.

You must have the :attr:`~Permissions.manage_guild` and
:attr:`~Permissions.kick_members` permissions to use this;
if :attr:`Guild.features` contains ``PRUNE_REQUIRES_ADMIN``,
you must have :attr:`~Permissions.administrator` permission instead.

.. versionchanged:: 2.6
Raises :exc:`TypeError` instead of ``InvalidArgument``.

Expand Down
6 changes: 4 additions & 2 deletions disnake/types/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ class UnavailableGuild(TypedDict):
"DEVELOPER_SUPPORT_SERVER",
"DISCOVERABLE",
"ENABLED_DISCOVERABLE_BEFORE",
"ENHANCED_ROLE_COLORS",
"FEATURABLE",
"GUILD_HOME_TEST", # not yet documented/finalised
"GUESTS_ENABLED",
"GUILD_TAGS",
"HAS_DIRECTORY_ENTRY",
"HUB",
"INVITE_SPLASH",
"INVITES_DISABLED",
"LINKED_TO_HUB",
"MEMBER_PROFILES", # not sure what this does, if anything
"MEMBER_VERIFICATION_GATE_ENABLED",
"MORE_EMOJI",
"MORE_SOUNDBOARD",
Expand All @@ -70,6 +71,7 @@ class UnavailableGuild(TypedDict):
"PARTNERED",
"PREVIEW_ENABLED",
"PRIVATE_THREADS", # deprecated
"PRUNE_REQUIRES_ADMIN",
"RAID_ALERTS_DISABLED",
"RELAY_ENABLED",
"ROLE_ICONS",
Expand Down