discord.py 2.0 update (3d914e08->2.0.1) (#5709)

This commit is contained in:
Jakub Kuczys
2022-10-03 16:07:15 +02:00
committed by GitHub
parent d7d6ab46f4
commit f02528378f
44 changed files with 454 additions and 317 deletions

View File

@@ -100,7 +100,7 @@ class FormattingUtilities(MixinMeta, metaclass=CompositeMetaClass):
try:
await lavalink.connect(
ctx.author.voice.channel,
deafen=await self.config.guild_from_id(ctx.guild.id).auto_deafen(),
self_deaf=await self.config.guild_from_id(ctx.guild.id).auto_deafen(),
)
except AttributeError:
return await self.send_embed_msg(ctx, title=_("Connect to a voice channel first."))

View File

@@ -99,7 +99,9 @@ class MiscellaneousUtilities(MixinMeta, metaclass=CompositeMetaClass):
embed.set_author(name=name)
return await ctx.send(embed=embed)
def _has_notify_perms(self, channel: Union[discord.TextChannel, discord.Thread]) -> bool:
def _has_notify_perms(
self, channel: Union[discord.TextChannel, discord.VoiceChannel, discord.Thread]
) -> bool:
perms = channel.permissions_for(channel.guild.me)
return all((can_user_send_messages_in(channel.guild.me, channel), perms.embed_links))

View File

@@ -114,8 +114,7 @@ class PlayerUtilities(MixinMeta, metaclass=CompositeMetaClass):
dj_role = self._dj_role_cache.setdefault(
ctx.guild.id, await self.config.guild(ctx.guild).dj_role()
)
dj_role_obj = ctx.guild.get_role(dj_role)
return dj_role_obj in ctx.guild.get_member(member.id).roles
return member.get_role(dj_role) is not None
async def is_requester(self, ctx: commands.Context, member: discord.Member) -> bool:
try:
@@ -711,7 +710,7 @@ class PlayerUtilities(MixinMeta, metaclass=CompositeMetaClass):
):
await player.move_to(
user_channel,
deafen=await self.config.guild_from_id(ctx.guild.id).auto_deafen(),
self_deaf=await self.config.guild_from_id(ctx.guild.id).auto_deafen(),
)
return True
else:

View File

@@ -545,7 +545,7 @@ class PlaylistUtilities(MixinMeta, metaclass=CompositeMetaClass):
return False
await lavalink.connect(
ctx.author.voice.channel,
deafen=await self.config.guild_from_id(ctx.guild.id).auto_deafen(),
self_deaf=await self.config.guild_from_id(ctx.guild.id).auto_deafen(),
)
except NodeNotFound:
await self.send_embed_msg(

View File

@@ -60,7 +60,9 @@ class ValidationUtilities(MixinMeta, metaclass=CompositeMetaClass):
async def is_query_allowed(
self,
config: Config,
ctx_or_channel: Optional[Union[Context, discord.TextChannel, discord.Thread]],
ctx_or_channel: Optional[
Union[Context, discord.TextChannel, discord.VoiceChannel, discord.Thread]
],
query: str,
query_obj: Query,
) -> bool: