Skip to content

Commit

Permalink
feat: ✨ Add missing soundboard and monetization permissions (#2620)
Browse files Browse the repository at this point in the history
* ✨ Soundboard perms (`1 << 42`, `1 << 45`)

* ✨ Add creator monetization analytics perms (`1 << 41`)

* 📝 CHANGELOG.md

* Update CHANGELOG.md

Signed-off-by: Dorukyum <[email protected]>

---------

Signed-off-by: Dorukyum <[email protected]>
Co-authored-by: plun1331 <[email protected]>
Co-authored-by: Dorukyum <[email protected]>
  • Loading branch information
3 people authored Nov 3, 2024
1 parent 48c5950 commit 968a586
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ These changes are available on the `master` branch, but have not yet been releas
([#2590](https://github.com/Pycord-Development/pycord/pull/2590))
- Added missing `with_counts` parameter to `fetch_guilds` method.
([#2615](https://github.com/Pycord-Development/pycord/pull/2615))
- Added missing permissions: `Permissions.use_soundboard`,
`Permissions.use_external_sounds` and
`Permissions.view_creator_monetization_analytics`.
([#2620](https://github.com/Pycord-Development/pycord/pull/2620))

### Fixed

Expand Down
33 changes: 31 additions & 2 deletions discord/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def all_channel(cls: type[P]) -> P:
- :attr:`manage_emojis`
- :attr:`view_audit_log`
- :attr:`view_guild_insights`
- :attr:`view_creator_monetization_analytics`
- :attr:`manage_guild`
- :attr:`change_nickname`
- :attr:`manage_nicknames`
Expand Down Expand Up @@ -218,8 +219,10 @@ def general(cls: type[P]) -> P:
permissions :attr:`administrator`, :attr:`create_instant_invite`, :attr:`kick_members`,
:attr:`ban_members`, :attr:`change_nickname` and :attr:`manage_nicknames` are
no longer part of the general permissions.
.. versionchanged:: 2.7
Added :attr:`view_creator_monetization_analytics` permission.
"""
return cls(0b01110000000010000000010010110000)
return cls(0b100000000001110000000010000000010010110000)

@classmethod
def membership(cls: type[P]) -> P:
Expand Down Expand Up @@ -250,7 +253,7 @@ def voice(cls: type[P]) -> P:
"""A factory method that creates a :class:`Permissions` with all
"Voice" permissions from the official Discord UI set to ``True``.
"""
return cls(0b1000000001000000000000011111100000000001100000000)
return cls(0b1001001001000000000000011111100000000001100000000)

@classmethod
def stage(cls: type[P]) -> P:
Expand Down Expand Up @@ -610,6 +613,30 @@ def moderate_members(self) -> int:
"""
return 1 << 40

@flag_value
def view_creator_monetization_analytics(self) -> int:
""":class:`bool`: Returns ``True`` if a user can view creator monetization (role subscription) analytics.
.. versionadded:: 2.7
"""
return 1 << 41

@flag_value
def use_soundboard(self) -> int:
""":class:`bool`: Returns ``True`` if a user can use the soundboard in a voice channel.
.. versionadded:: 2.7
"""
return 1 << 42

@flag_value
def use_external_sounds(self) -> int:
""":class:`bool`: Returns ``True`` if a user can use external soundboard sounds in a voice channel.
.. versionadded:: 2.7
"""
return 1 << 45

@flag_value
def send_voice_messages(self) -> int:
""":class:`bool`: Returns ``True`` if a member can send voice messages.
Expand Down Expand Up @@ -762,6 +789,8 @@ class PermissionOverwrite:
use_external_stickers: bool | None
start_embedded_activities: bool | None
moderate_members: bool | None
use_soundboard: bool | None
use_external_sounds: bool | None
send_voice_messages: bool | None
set_voice_channel_status: bool | None
send_polls: bool | None
Expand Down

0 comments on commit 968a586

Please sign in to comment.