Skip to content

Commit d6693d3

Browse files
yoggyspre-commit-ci[bot]Lulalabyplun1331
authored
fix: Proper type-hinting & docstring of Member.move_to and Member.edit (#2386)
* fix: proper type-hinting of `Member.move_to` * style(pre-commit): auto fixes from pre-commit.com hooks * Update CHANGELOG.md Signed-off-by: Lala Sabathil <[email protected]> * add pr Signed-off-by: Lala Sabathil <[email protected]> * Update CHANGELOG.md Signed-off-by: plun1331 <[email protected]> * fix: docstring for `Member.edit` and `Member.move_to` * style(pre-commit): auto fixes from pre-commit.com hooks * further docstrings updates & typing --------- Signed-off-by: Lala Sabathil <[email protected]> Signed-off-by: plun1331 <[email protected]> Signed-off-by: YoggieS <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Lala Sabathil <[email protected]> Co-authored-by: plun1331 <[email protected]>
1 parent 9b1c86c commit d6693d3

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ possible (see our [Version Guarantees] for more info).
1010

1111
These changes are available on the `master` branch, but have not yet been released.
1212

13+
### Fixed
14+
15+
- Fixed the type-hinting of `Member.move_to` and `Member.edit` to reflect actual
16+
behavior. ([#2386](https://github.com/Pycord-Development/pycord/pull/2386))
17+
1318
### Changed
1419

1520
- Changed the type of `Guild.bitrate_limit` to `int`.

discord/flags.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,11 @@ def voice_states(self):
830830
831831
- :attr:`VoiceChannel.members`
832832
- :attr:`VoiceChannel.voice_states`
833+
- :attr:`StageChannel.members`
834+
- :attr:`StageChannel.speakers`
835+
- :attr:`StageChannel.listeners`
836+
- :attr:`StageChannel.moderators`
837+
- :attr:`StageChannel.voice_states`
833838
- :attr:`Member.voice`
834839
835840
.. note::

discord/guild.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def _from_data(self, guild: GuildPayload) -> None:
539539
)
540540

541541
self.owner_id: int | None = utils._get_as_snowflake(guild, "owner_id")
542-
self.afk_channel: VocalGuildChannel | None = self.get_channel(
542+
self.afk_channel: VoiceChannel | None = self.get_channel(
543543
utils._get_as_snowflake(guild, "afk_channel_id")
544544
) # type: ignore
545545

@@ -3422,7 +3422,7 @@ async def change_voice_state(
34223422
34233423
Parameters
34243424
----------
3425-
channel: Optional[:class:`VoiceChannel`]
3425+
channel: Optional[Union[:class:`VoiceChannel`, :class:`StageChannel`]]
34263426
Channel the client wants to join. Use ``None`` to disconnect.
34273427
self_mute: :class:`bool`
34283428
Indicates if the client should be self-muted.

discord/member.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ async def edit(
769769
770770
roles: List[:class:`Role`]
771771
The member's new list of roles. This *replaces* the roles.
772-
voice_channel: Optional[:class:`VoiceChannel`]
772+
voice_channel: Optional[Union[:class:`VoiceChannel`, :class:`StageChannel`]]
773773
The voice channel to move the member to.
774774
Pass ``None`` to kick them from voice.
775775
reason: Optional[:class:`str`]
@@ -958,7 +958,7 @@ async def request_to_speak(self) -> None:
958958
await self._state.http.edit_my_voice_state(self.guild.id, payload)
959959

960960
async def move_to(
961-
self, channel: VocalGuildChannel, *, reason: str | None = None
961+
self, channel: VocalGuildChannel | None, *, reason: str | None = None
962962
) -> None:
963963
"""|coro|
964964
@@ -974,7 +974,7 @@ async def move_to(
974974
975975
Parameters
976976
----------
977-
channel: Optional[:class:`VoiceChannel`]
977+
channel: Optional[Union[:class:`VoiceChannel`, :class:`StageChannel`]]
978978
The new voice channel to move the member to.
979979
Pass ``None`` to kick them from voice.
980980
reason: Optional[:class:`str`]

discord/raw_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ class AutoModActionExecutionEvent:
596596
The member that triggered the action, if cached.
597597
channel_id: Optional[:class:`int`]
598598
The ID of the channel in which the member's content was posted.
599-
channel: Optional[Union[:class:`TextChannel`, :class:`Thread`, :class:`VoiceChannel`]]
599+
channel: Optional[Union[:class:`TextChannel`, :class:`Thread`, :class:`VoiceChannel`, :class:`StageChannel`]]
600600
The channel in which the member's content was posted, if cached.
601601
message_id: Optional[:class:`int`]
602602
The ID of the message that triggered the action. This is only available if the

0 commit comments

Comments
 (0)