Skip to content

Commit afa6733

Browse files
authored
Merge branch 'master' into fix-auto-sync
Signed-off-by: Ice Wolfy <44532864+Icebluewolf@users.noreply.github.com>
2 parents 16cc145 + 2d762d6 commit afa6733

10 files changed

Lines changed: 67 additions & 28 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
- name: "Checkout repository"
2929
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3030
- name: "Initialize CodeQL"
31-
uses: github/codeql-action/init@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
31+
uses: github/codeql-action/init@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
3232
with:
3333
languages: ${{ matrix.language }}
3434
- name: "Autobuild"
35-
uses: github/codeql-action/autobuild@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
35+
uses: github/codeql-action/autobuild@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7
3636
- name: "Perform CodeQL Analysis"
37-
uses: github/codeql-action/analyze@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
37+
uses: github/codeql-action/analyze@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ These changes are available on the `master` branch, but have not yet been releas
1414

1515
- Added `Member.vr_status` property.
1616
([#3328](https://github.com/Pycord-Development/pycord/pull/3328))
17-
- Documented `SlashCommandGroup.add_command`.
17+
- Added `SlashCommandGroup.add_command`.
1818
([#3346](https://github.com/Pycord-Development/pycord/pull/3346))
1919

2020
### Changed
@@ -1839,7 +1839,7 @@ These changes are available on the `master` branch, but have not yet been releas
18391839
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.8.1...HEAD
18401840
[2.8.1]: https://github.com/Pycord-Development/pycord/compare/v2.8.0...v2.8.1
18411841
[2.8.0]: https://github.com/Pycord-Development/pycord/compare/v2.7.2...v2.8.0
1842-
[2.8.0rc1]: https://github.com/Pycord-Development/pycord/compare/v2.8.0rc1...v2.8.0rc2
1842+
[2.8.0rc2]: https://github.com/Pycord-Development/pycord/compare/v2.8.0rc1...v2.8.0rc2
18431843
[2.8.0rc1]: https://github.com/Pycord-Development/pycord/compare/v2.7.2...v2.8.0rc1
18441844
[2.7.2]: https://github.com/Pycord-Development/pycord/compare/v2.7.1...v2.7.2
18451845
[2.7.1]: https://github.com/Pycord-Development/pycord/compare/v2.7.0...v2.7.1

discord/abc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ def __init__(
351351
): ...
352352

353353
def __str__(self) -> str:
354+
flags = getattr(self, "flags", None)
355+
if flags is not None and getattr(flags, "obfuscated", False):
356+
return f"Obfuscated Channel ({self.id})"
357+
354358
return self.name
355359

356360
@property

discord/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ class Client:
169169
If not given, defaults to a regularly constructed :class:`Intents` class.
170170
171171
.. versionadded:: 1.5
172+
capabilities: :class:`GatewayCapabilities`
173+
Gateway capabilities to include with the IDENTIFY payload. Defaults to
174+
:meth:`GatewayCapabilities.none`. These are mostly undocumented and may not
175+
be supported for bot accounts.
172176
member_cache_flags: :class:`MemberCacheFlags`
173177
Allows for finer control over how the library caches members.
174178
If not given, defaults to cache as much as possible with the

discord/flags.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"MessageFlags",
3636
"AttachmentFlags",
3737
"PublicUserFlags",
38+
"GatewayCapabilities",
3839
"Intents",
3940
"MemberCacheFlags",
4041
"ApplicationFlags",
@@ -588,6 +589,36 @@ def all(self) -> list[UserFlags]:
588589
]
589590

590591

592+
@fill_with_flags()
593+
class GatewayCapabilities(BaseFlags):
594+
"""Wraps Discord gateway capabilities.
595+
596+
These bits are mostly undocumented and meant for specialized clients. They are
597+
sent with the IDENTIFY payload as the ``capabilities`` field.
598+
599+
Attributes
600+
----------
601+
value: :class:`int`
602+
The raw capability value. Prefer toggling via the provided attributes.
603+
"""
604+
605+
__slots__ = ()
606+
607+
@classmethod
608+
def none(cls) -> GatewayCapabilities:
609+
"""Creates a :class:`GatewayCapabilities` instance with no bits enabled."""
610+
611+
self = cls.__new__(cls)
612+
self.value = cls.DEFAULT_VALUE
613+
return self
614+
615+
@flag_value
616+
def obfuscated_channels(self):
617+
""":class:`bool`: Obfuscates channel identifiers in gateway events."""
618+
619+
return 1 << 15
620+
621+
591622
@fill_with_flags()
592623
class Intents(BaseFlags):
593624
r"""Wraps up a Discord gateway intent flag.
@@ -1587,6 +1618,12 @@ def hide_media_download_options(self):
15871618
"""
15881619
return 1 << 15
15891620

1621+
@flag_value
1622+
def obfuscated(self):
1623+
""":class:`bool`: Returns ``True`` if the channel is obfuscated by the gateway."""
1624+
1625+
return 1 << 17
1626+
15901627

15911628
@fill_with_flags()
15921629
class AttachmentFlags(BaseFlags):

discord/gateway.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ async def from_client(
368368
ws.session_id = session
369369
ws.sequence = sequence
370370
ws._max_heartbeat_timeout = client._connection.heartbeat_timeout
371+
ws.capabilities = client._connection.capabilities.value
371372

372373
if client._enable_debug_events:
373374
ws.send = ws.debug_send
@@ -432,6 +433,9 @@ async def identify(self) -> None:
432433
},
433434
"compress": True,
434435
"large_threshold": 250,
436+
"capabilities": (
437+
self.capabilities if hasattr(self, "capabilities") else 0
438+
),
435439
},
436440
}
437441

discord/state.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
from .channel import _channel_factory
5050
from .emoji import AppEmoji, GuildEmoji
5151
from .enums import ChannelType, InteractionType, ScheduledEventStatus, Status, try_enum
52-
from .flags import ApplicationFlags, Intents, MemberCacheFlags
52+
from .flags import ApplicationFlags, GatewayCapabilities, Intents, MemberCacheFlags
5353
from .guild import Guild
5454
from .integrations import _integration_factory
5555
from .interactions import Interaction
@@ -247,6 +247,18 @@ def __init__(
247247
self._status: str | None = status
248248
self._intents: Intents = intents
249249

250+
capabilities = options.get("capabilities")
251+
if capabilities is None:
252+
capabilities = GatewayCapabilities.none()
253+
elif isinstance(capabilities, int):
254+
capabilities = GatewayCapabilities._from_value(capabilities)
255+
elif not isinstance(capabilities, GatewayCapabilities):
256+
raise TypeError(
257+
"capabilities parameter must be GatewayCapabilities or int."
258+
)
259+
260+
self.capabilities: GatewayCapabilities = capabilities
261+
250262
if not intents.members or cache_flags._empty:
251263
self.store_user = self.create_user # type: ignore
252264
self.deref_user = self.deref_user_no_intents # type: ignore

discord/ui/media_gallery.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ class MediaGallery(ViewItem[V]):
5555
The initial items contained in this gallery, up to 10.
5656
id: Optional[:class:`int`]
5757
The gallery's ID.
58-
59-
Attributes
60-
----------
61-
items: List[:class:`~discord.MediaGalleryItem`]
62-
The list of media items in this gallery.
6358
"""
6459

6560
__item_repr_attributes__: tuple[str, ...] = (

discord/ui/radio_group.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@ class RadioGroup(ModalItem):
4646
"""Represents a UI Radio Group component.
4747
4848
.. versionadded:: 2.8
49-
50-
Attributes
51-
----------
52-
custom_id: Optional[:class:`str`]
53-
The ID of the radio group that gets received during an interaction.
54-
options: List[:class:`discord.RadioGroupOption`]
55-
A list of options that can be selected from this group. Must provide between 2 and 10 options.
56-
required: Optional[:class:`bool`]
57-
Whether an option selection is required or not. Defaults to ``True``.
58-
id: Optional[:class:`int`]
59-
The radio group's ID.
6049
"""
6150

6251
__item_repr_attributes__: tuple[str, ...] = (

discord/voice/client.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ class VoiceClient(VoiceProtocol):
8585
8686
Attributes
8787
----------
88-
session_id: :class:`str`
89-
The voice connection session ID.
90-
token: :class:`str`
91-
The voice connection token.
92-
endpoint: :class:`str`
93-
The endpoint we are connecting to.
9488
channel: Union[:class:`VoiceChannel`, :class:`StageChannel`]
9589
The channel we are connected to.
9690

0 commit comments

Comments
 (0)