mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-12 08:49:48 +00:00
Add VoiceChannel and Thread to isinstance checks
This commit is contained in:
parent
9450a8e972
commit
cdf787186e
@ -2317,7 +2317,9 @@ def is_nsfw() -> Check[Any]:
|
|||||||
|
|
||||||
def pred(ctx: Context[BotT]) -> bool:
|
def pred(ctx: Context[BotT]) -> bool:
|
||||||
ch = ctx.channel
|
ch = ctx.channel
|
||||||
if ctx.guild is None or (isinstance(ch, (discord.TextChannel, discord.Thread)) and ch.is_nsfw()):
|
if ctx.guild is None or (
|
||||||
|
isinstance(ch, (discord.TextChannel, discord.Thread, discord.VoiceChannel)) and ch.is_nsfw()
|
||||||
|
):
|
||||||
return True
|
return True
|
||||||
raise NSFWChannelRequired(ch) # type: ignore
|
raise NSFWChannelRequired(ch) # type: ignore
|
||||||
|
|
||||||
|
@ -1485,7 +1485,7 @@ class ConnectionState:
|
|||||||
self.dispatch('raw_typing', raw)
|
self.dispatch('raw_typing', raw)
|
||||||
|
|
||||||
def _get_reaction_user(self, channel: MessageableChannel, user_id: int) -> Optional[Union[User, Member]]:
|
def _get_reaction_user(self, channel: MessageableChannel, user_id: int) -> Optional[Union[User, Member]]:
|
||||||
if isinstance(channel, TextChannel):
|
if isinstance(channel, (TextChannel, Thread, VoiceChannel)):
|
||||||
return channel.guild.get_member(user_id)
|
return channel.guild.get_member(user_id)
|
||||||
return self.get_user(user_id)
|
return self.get_user(user_id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user