Fixed some bugs
This commit is contained in:
@@ -146,8 +146,7 @@ class Basic(commands.Cog):
|
||||
query = ""
|
||||
|
||||
if message.content:
|
||||
url = re.findall(
|
||||
"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", message.content)
|
||||
url = re.findall(r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", message.content)
|
||||
if url:
|
||||
query = url[0]
|
||||
|
||||
@@ -467,7 +466,7 @@ class Basic(commands.Cog):
|
||||
if player.queue.is_empty:
|
||||
return await nowplay(ctx, player)
|
||||
view = ListView(player=player, author=ctx.author)
|
||||
view.response = await ctx.send(embed=view.build_embed(), view=view)
|
||||
view.response = await ctx.send(embed=await view.build_embed(), view=view)
|
||||
|
||||
@queue.command(name="export", aliases=get_aliases("export"))
|
||||
@commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild)
|
||||
@@ -553,8 +552,8 @@ class Basic(commands.Cog):
|
||||
if not player.queue.history():
|
||||
return await nowplay(ctx, player)
|
||||
|
||||
view = ListView(player=player, author=ctx.author, isQueue=False)
|
||||
view.response = await ctx.send(embed=view.build_embed(), view=view)
|
||||
view = ListView(player=player, author=ctx.author, is_queue=False)
|
||||
view.response = await ctx.send(embed=await view.build_embed(), view=view)
|
||||
|
||||
@commands.hybrid_command(name="leave", aliases=get_aliases("leave"))
|
||||
@commands.dynamic_cooldown(cooldown_check, commands.BucketType.guild)
|
||||
@@ -890,4 +889,4 @@ class Basic(commands.Cog):
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
async def setup(bot: commands.Bot) -> None:
|
||||
await bot.add_cog(Basic(bot))
|
||||
await bot.add_cog(Basic(bot))
|
||||
@@ -131,7 +131,7 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
player = await voicelink.connect_channel(ctx)
|
||||
|
||||
if result['playlist']['type'] == 'link':
|
||||
tracks = await search_playlist(result['playlist']['uri'], ctx.author, timeNeed=False)
|
||||
tracks = await search_playlist(result['playlist']['uri'], ctx.author, time_needed=False)
|
||||
else:
|
||||
if not result['playlist']['tracks']:
|
||||
return await send(ctx, 'playlistNoTrack', result['playlist']['name'], ephemeral=True)
|
||||
@@ -443,7 +443,7 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
return await send(ctx, 'playlistNotFound', name, ephemeral=True)
|
||||
|
||||
if result['playlist']['type'] == 'link':
|
||||
tracks = await search_playlist(result['playlist']['uri'], ctx.author, timeNeed=False)
|
||||
tracks = await search_playlist(result['playlist']['uri'], ctx.author, time_needed=False)
|
||||
else:
|
||||
if not result['playlist']['tracks']:
|
||||
return await send(ctx, 'playlistNoTrack', result['playlist']['name'], ephemeral=True)
|
||||
@@ -508,4 +508,4 @@ class Playlists(commands.Cog, name="playlist"):
|
||||
return await send(ctx, "decodeError", ephemeral=True)
|
||||
|
||||
async def setup(bot: commands.Bot) -> None:
|
||||
await bot.add_cog(Playlists(bot))
|
||||
await bot.add_cog(Playlists(bot))
|
||||
@@ -47,8 +47,8 @@ class ControlButton(discord.ui.Button):
|
||||
):
|
||||
self.player: voicelink.Player = player
|
||||
|
||||
disable_button_text = not func.settings.controller.get("disableButtonText", False)
|
||||
super().__init__(label=player.get_msg(label) if label and disable_button_text else None, **kwargs)
|
||||
self.disable_button_text: bool = func.settings.controller.get("disableButtonText", False)
|
||||
super().__init__(label=player.get_msg(label) if label and not self.disable_button_text else None, **kwargs)
|
||||
|
||||
async def send(self, interaction: discord.Interaction, key:str, *params, ephemeral: bool = False) -> None:
|
||||
stay = self.player.settings.get("controller_msg", True)
|
||||
@@ -100,11 +100,11 @@ class Resume(ControlButton):
|
||||
)
|
||||
|
||||
async def callback(self, interaction: discord.Interaction):
|
||||
is_paused = self.player.is_paused
|
||||
vote_type = "resume" if is_paused else "pause"
|
||||
is_paused = not self.player.is_paused
|
||||
vote_type = "pause" if is_paused else "resume"
|
||||
votes = getattr(self.player, f"{vote_type}_votes")
|
||||
emoji = "⏸️" if is_paused else "▶️"
|
||||
button = "buttonPause" if is_paused else "buttonResume"
|
||||
emoji = "▶️" if is_paused else "⏸️"
|
||||
button = "buttonResume" if is_paused else "buttonPause"
|
||||
|
||||
if not self.player.is_privileged(interaction.user):
|
||||
if interaction.user in votes:
|
||||
@@ -116,7 +116,8 @@ class Resume(ControlButton):
|
||||
|
||||
votes.clear()
|
||||
self.emoji = emoji
|
||||
self.label = await func.get_lang(interaction.guild.id, button)
|
||||
if not self.disable_button_text:
|
||||
self.label = await func.get_lang(interaction.guild.id, button)
|
||||
await self.player.set_pause(is_paused, interaction.user)
|
||||
await interaction.response.edit_message(view=self.view)
|
||||
|
||||
@@ -262,7 +263,8 @@ class VolumeMute(ControlButton):
|
||||
is_muted = self.player.volume != 0
|
||||
value = 0 if is_muted else self.player.settings.get("volume", 100)
|
||||
self.emoji = "🔈" if is_muted else "🔇"
|
||||
self.label = await func.get_lang(interaction.guild_id, "buttonVolumeUnmute" if is_muted else "buttonVolumeMute")
|
||||
if not self.disable_button_text:
|
||||
self.label = await func.get_lang(interaction.guild_id, "buttonVolumeUnmute" if is_muted else "buttonVolumeMute")
|
||||
|
||||
await self.player.set_volume(value, interaction.user)
|
||||
await interaction.response.edit_message(view=self.view)
|
||||
|
||||
Reference in New Issue
Block a user