From c430fbb4ef97454ac78248af3c776ac1bc09bcf4 Mon Sep 17 00:00:00 2001 From: balaclava <71716568+controlado@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:11:24 -0300 Subject: [PATCH] fix: `is_owner()` `user` type hint (#2593) * fix(is_owner) `user` type hint The `user` parameter must accept both a `User` and a `Member`, as the docstring itself says. Signed-off-by: balaclava <71716568+controlado@users.noreply.github.com> * Update CHANGELOG.md Signed-off-by: balaclava <71716568+controlado@users.noreply.github.com> --------- Signed-off-by: balaclava <71716568+controlado@users.noreply.github.com> --- CHANGELOG.md | 2 ++ discord/bot.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c5ed63053..dba975bd37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ These changes are available on the `master` branch, but have not yet been releas documentation. ([#2581](https://github.com/Pycord-Development/pycord/pull/2581)) - Fixed a possible bug where audio would play too fast at the beginning of audio files. ([#2584](https://github.com/Pycord-Development/pycord/pull/2584)) +- Fixed the `is_owner()` `user` type hint: `User` -> `User | Member`. + ([#2593](https://github.com/Pycord-Development/pycord/pull/2593)) ### Changed diff --git a/discord/bot.py b/discord/bot.py index 6ecc921f5c..f97701f8f3 100644 --- a/discord/bot.py +++ b/discord/bot.py @@ -1407,7 +1407,7 @@ def after_invoke(self, coro): self._after_invoke = coro return coro - async def is_owner(self, user: User) -> bool: + async def is_owner(self, user: User | Member) -> bool: """|coro| Checks if a :class:`~discord.User` or :class:`~discord.Member` is the owner of @@ -1422,7 +1422,7 @@ async def is_owner(self, user: User) -> bool: Parameters ---------- - user: :class:`.abc.User` + user: Union[:class:`.abc.User`, :class:`.member.Member`] The user to check for. Returns