Skip to content

Commit 26f8dcd

Browse files
authored
Merge branch 'master' into soundboard
Signed-off-by: Paillat <[email protected]>
2 parents 9a08df5 + 968a586 commit 26f8dcd

File tree

5 files changed

+64
-8
lines changed

5 files changed

+64
-8
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,21 @@ These changes are available on the `master` branch, but have not yet been releas
3030
([#2587](https://github.com/Pycord-Development/pycord/pull/2587/))
3131
- Added optional `filter` parameter to `utils.basic_autocomplete()`.
3232
([#2590](https://github.com/Pycord-Development/pycord/pull/2590))
33-
- Added soundboard support :tada:
33+
- Added missing `with_counts` parameter to `fetch_guilds` method.
34+
([#2615](https://github.com/Pycord-Development/pycord/pull/2615))
35+
- Added missing permissions: `Permissions.use_soundboard`,
36+
`Permissions.use_external_sounds` and
37+
`Permissions.view_creator_monetization_analytics`.
38+
([#2620](https://github.com/Pycord-Development/pycord/pull/2620))
39+
- Added soundboard features
3440
- Manage guild soundboard sounds with `Guild.fetch_sounds()`, `Guild.create_sound()`,
3541
`SoundboardSound.edit()`, and `SoundboardSound.delete()`
3642
- Access Discord's default sounds with `Client.fetch_default_sounds()`
3743
- Play sounds in voice channels with `VoiceChannel.send_soundboard_sound()`
3844
- New `on_voice_channel_effect_send` event for sound and emoji effects
3945
- Soundboard limits based on guild premium tier (8-48 slots) in
4046
`Guild.soundboard_limit`
41-
([#2623](https://github.com/Pycord-Development/pycord/pull/2623))
47+
([#2623](https://github.com/Pycord-Development/pycord/pull/2623))
4248

4349
### Fixed
4450

discord/client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,7 @@ def fetch_guilds(
14641464
limit: int | None = 100,
14651465
before: SnowflakeTime = None,
14661466
after: SnowflakeTime = None,
1467+
with_counts: bool = True,
14671468
) -> GuildIterator:
14681469
"""Retrieves an :class:`.AsyncIterator` that enables receiving your guilds.
14691470
@@ -1491,6 +1492,11 @@ def fetch_guilds(
14911492
Retrieve guilds after this date or object.
14921493
If a datetime is provided, it is recommended to use a UTC aware datetime.
14931494
If the datetime is naive, it is assumed to be local time.
1495+
with_counts: :class:`bool`
1496+
Whether to include member count information in guilds. This fills the
1497+
:attr:`.Guild.approximate_member_count` and :attr:`.Guild.approximate_presence_count`
1498+
fields.
1499+
Defaults to ``True``.
14941500
14951501
Yields
14961502
------
@@ -1517,7 +1523,9 @@ def fetch_guilds(
15171523
15181524
All parameters are optional.
15191525
"""
1520-
return GuildIterator(self, limit=limit, before=before, after=after)
1526+
return GuildIterator(
1527+
self, limit=limit, before=before, after=after, with_counts=with_counts
1528+
)
15211529

15221530
async def fetch_template(self, code: Template | str) -> Template:
15231531
"""|coro|

discord/http.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,7 @@ def get_guilds(
14471447
limit: int,
14481448
before: Snowflake | None = None,
14491449
after: Snowflake | None = None,
1450+
with_counts: bool = True,
14501451
) -> Response[list[guild.Guild]]:
14511452
params: dict[str, Any] = {
14521453
"limit": limit,
@@ -1456,6 +1457,8 @@ def get_guilds(
14561457
params["before"] = before
14571458
if after:
14581459
params["after"] = after
1460+
if with_counts:
1461+
params["with_counts"] = int(with_counts)
14591462

14601463
return self.request(Route("GET", "/users/@me/guilds"), params=params)
14611464

discord/iterators.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,14 @@ class GuildIterator(_AsyncIterator["Guild"]):
585585
Object before which all guilds must be.
586586
after: Optional[Union[:class:`abc.Snowflake`, :class:`datetime.datetime`]]
587587
Object after which all guilds must be.
588+
with_counts: :class:`bool`
589+
Whether to include member count information in guilds. This fills the
590+
:attr:`.Guild.approximate_member_count` and :attr:`.Guild.approximate_presence_count`
591+
fields.
592+
Defaults to ``True``.
588593
"""
589594

590-
def __init__(self, bot, limit, before=None, after=None):
595+
def __init__(self, bot, limit, before=None, after=None, with_counts=True):
591596
if isinstance(before, datetime.datetime):
592597
before = Object(id=time_snowflake(before, high=False))
593598
if isinstance(after, datetime.datetime):
@@ -597,6 +602,7 @@ def __init__(self, bot, limit, before=None, after=None):
597602
self.limit = limit
598603
self.before = before
599604
self.after = after
605+
self.with_counts = with_counts
600606

601607
self._filter = None
602608

@@ -654,7 +660,9 @@ async def _retrieve_guilds(self, retrieve) -> list[Guild]:
654660
async def _retrieve_guilds_before_strategy(self, retrieve):
655661
"""Retrieve guilds using before parameter."""
656662
before = self.before.id if self.before else None
657-
data: list[GuildPayload] = await self.get_guilds(retrieve, before=before)
663+
data: list[GuildPayload] = await self.get_guilds(
664+
retrieve, before=before, with_counts=self.with_counts
665+
)
658666
if len(data):
659667
if self.limit is not None:
660668
self.limit -= retrieve
@@ -664,7 +672,9 @@ async def _retrieve_guilds_before_strategy(self, retrieve):
664672
async def _retrieve_guilds_after_strategy(self, retrieve):
665673
"""Retrieve guilds using after parameter."""
666674
after = self.after.id if self.after else None
667-
data: list[GuildPayload] = await self.get_guilds(retrieve, after=after)
675+
data: list[GuildPayload] = await self.get_guilds(
676+
retrieve, after=after, with_counts=self.with_counts
677+
)
668678
if len(data):
669679
if self.limit is not None:
670680
self.limit -= retrieve

discord/permissions.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def all_channel(cls: type[P]) -> P:
191191
- :attr:`manage_emojis`
192192
- :attr:`view_audit_log`
193193
- :attr:`view_guild_insights`
194+
- :attr:`view_creator_monetization_analytics`
194195
- :attr:`manage_guild`
195196
- :attr:`change_nickname`
196197
- :attr:`manage_nicknames`
@@ -218,8 +219,10 @@ def general(cls: type[P]) -> P:
218219
permissions :attr:`administrator`, :attr:`create_instant_invite`, :attr:`kick_members`,
219220
:attr:`ban_members`, :attr:`change_nickname` and :attr:`manage_nicknames` are
220221
no longer part of the general permissions.
222+
.. versionchanged:: 2.7
223+
Added :attr:`view_creator_monetization_analytics` permission.
221224
"""
222-
return cls(0b01110000000010000000010010110000)
225+
return cls(0b100000000001110000000010000000010010110000)
223226

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

255258
@classmethod
256259
def stage(cls: type[P]) -> P:
@@ -610,6 +613,30 @@ def moderate_members(self) -> int:
610613
"""
611614
return 1 << 40
612615

616+
@flag_value
617+
def view_creator_monetization_analytics(self) -> int:
618+
""":class:`bool`: Returns ``True`` if a user can view creator monetization (role subscription) analytics.
619+
620+
.. versionadded:: 2.7
621+
"""
622+
return 1 << 41
623+
624+
@flag_value
625+
def use_soundboard(self) -> int:
626+
""":class:`bool`: Returns ``True`` if a user can use the soundboard in a voice channel.
627+
628+
.. versionadded:: 2.7
629+
"""
630+
return 1 << 42
631+
632+
@flag_value
633+
def use_external_sounds(self) -> int:
634+
""":class:`bool`: Returns ``True`` if a user can use external soundboard sounds in a voice channel.
635+
636+
.. versionadded:: 2.7
637+
"""
638+
return 1 << 45
639+
613640
@flag_value
614641
def send_voice_messages(self) -> int:
615642
""":class:`bool`: Returns ``True`` if a member can send voice messages.
@@ -762,6 +789,8 @@ class PermissionOverwrite:
762789
use_external_stickers: bool | None
763790
start_embedded_activities: bool | None
764791
moderate_members: bool | None
792+
use_soundboard: bool | None
793+
use_external_sounds: bool | None
765794
send_voice_messages: bool | None
766795
set_voice_channel_status: bool | None
767796
send_polls: bool | None

0 commit comments

Comments
 (0)