Skip to content

Commit

Permalink
fix: Proper type-hinting & docstring of Member.move_to and `Member.…
Browse files Browse the repository at this point in the history
…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 <aiko@aitsys.dev>

* add pr

Signed-off-by: Lala Sabathil <aiko@aitsys.dev>

* Update CHANGELOG.md

Signed-off-by: plun1331 <plun1331@gmail.com>

* 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 <aiko@aitsys.dev>
Signed-off-by: plun1331 <plun1331@gmail.com>
Signed-off-by: YoggieS <61660055+yoggys@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Lala Sabathil <aiko@aitsys.dev>
Co-authored-by: plun1331 <plun1331@gmail.com>
  • Loading branch information
4 people committed Mar 8, 2024
1 parent 9b1c86c commit d6693d3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,11 @@ possible (see our [Version Guarantees] for more info).

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

### Fixed

- Fixed the type-hinting of `Member.move_to` and `Member.edit` to reflect actual
behavior. ([#2386](https://github.com/Pycord-Development/pycord/pull/2386))

### Changed

- Changed the type of `Guild.bitrate_limit` to `int`.
Expand Down
5 changes: 5 additions & 0 deletions discord/flags.py
Expand Up @@ -830,6 +830,11 @@ def voice_states(self):
- :attr:`VoiceChannel.members`
- :attr:`VoiceChannel.voice_states`
- :attr:`StageChannel.members`
- :attr:`StageChannel.speakers`
- :attr:`StageChannel.listeners`
- :attr:`StageChannel.moderators`
- :attr:`StageChannel.voice_states`
- :attr:`Member.voice`
.. note::
Expand Down
4 changes: 2 additions & 2 deletions discord/guild.py
Expand Up @@ -539,7 +539,7 @@ def _from_data(self, guild: GuildPayload) -> None:
)

self.owner_id: int | None = utils._get_as_snowflake(guild, "owner_id")
self.afk_channel: VocalGuildChannel | None = self.get_channel(
self.afk_channel: VoiceChannel | None = self.get_channel(
utils._get_as_snowflake(guild, "afk_channel_id")
) # type: ignore

Expand Down Expand Up @@ -3422,7 +3422,7 @@ async def change_voice_state(
Parameters
----------
channel: Optional[:class:`VoiceChannel`]
channel: Optional[Union[:class:`VoiceChannel`, :class:`StageChannel`]]
Channel the client wants to join. Use ``None`` to disconnect.
self_mute: :class:`bool`
Indicates if the client should be self-muted.
Expand Down
6 changes: 3 additions & 3 deletions discord/member.py
Expand Up @@ -769,7 +769,7 @@ async def edit(
roles: List[:class:`Role`]
The member's new list of roles. This *replaces* the roles.
voice_channel: Optional[:class:`VoiceChannel`]
voice_channel: Optional[Union[:class:`VoiceChannel`, :class:`StageChannel`]]
The voice channel to move the member to.
Pass ``None`` to kick them from voice.
reason: Optional[:class:`str`]
Expand Down Expand Up @@ -958,7 +958,7 @@ async def request_to_speak(self) -> None:
await self._state.http.edit_my_voice_state(self.guild.id, payload)

async def move_to(
self, channel: VocalGuildChannel, *, reason: str | None = None
self, channel: VocalGuildChannel | None, *, reason: str | None = None
) -> None:
"""|coro|
Expand All @@ -974,7 +974,7 @@ async def move_to(
Parameters
----------
channel: Optional[:class:`VoiceChannel`]
channel: Optional[Union[:class:`VoiceChannel`, :class:`StageChannel`]]
The new voice channel to move the member to.
Pass ``None`` to kick them from voice.
reason: Optional[:class:`str`]
Expand Down
2 changes: 1 addition & 1 deletion discord/raw_models.py
Expand Up @@ -596,7 +596,7 @@ class AutoModActionExecutionEvent:
The member that triggered the action, if cached.
channel_id: Optional[:class:`int`]
The ID of the channel in which the member's content was posted.
channel: Optional[Union[:class:`TextChannel`, :class:`Thread`, :class:`VoiceChannel`]]
channel: Optional[Union[:class:`TextChannel`, :class:`Thread`, :class:`VoiceChannel`, :class:`StageChannel`]]
The channel in which the member's content was posted, if cached.
message_id: Optional[:class:`int`]
The ID of the message that triggered the action. This is only available if the
Expand Down

0 comments on commit d6693d3

Please sign in to comment.