mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 21:27:48 +00:00
Merge branch 'dev' into player-control-ui
This commit is contained in:
+12
-11
@@ -16,6 +16,7 @@ from lavalink.models import AudioTrack
|
||||
from lavalink.models import DefaultPlayer
|
||||
|
||||
from bot import ChristmasBot
|
||||
from utils.classes import BaseCog
|
||||
from context import CustomContext
|
||||
from utils.database import AutoJoin
|
||||
from utils.database import Playlist
|
||||
@@ -74,10 +75,7 @@ class LavalinkVoiceClient(discord.VoiceClient):
|
||||
self.cleanup()
|
||||
|
||||
|
||||
class Music(commands.Cog):
|
||||
def __init__(self, bot: ChristmasBot):
|
||||
self.bot = bot
|
||||
|
||||
class Music(BaseCog):
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
if not hasattr(
|
||||
@@ -118,7 +116,6 @@ class Music(commands.Cog):
|
||||
# Get the results for the query from Lavalink.
|
||||
for query in queries:
|
||||
result = await player.node.get_tracks(query)
|
||||
print(result)
|
||||
if not result or not result["tracks"]:
|
||||
continue
|
||||
|
||||
@@ -242,10 +239,14 @@ class Music(commands.Cog):
|
||||
|
||||
@commands.command(name="connect", aliases=["p", "play", "join"])
|
||||
async def play(self, ctx: CustomContext):
|
||||
"""Starts playing Christmas bangers"""
|
||||
"""Start the radio"""
|
||||
# Get the player for this guild from cache.
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
await self.fill_player_queue(player, self.bot.config["queue_buffer_size"] + 1)
|
||||
if player.is_connected:
|
||||
await ctx.send("Already connected")
|
||||
return
|
||||
|
||||
await self.fill_player_queue(player, self.bot.config["queue_buffer_size"]
|
||||
|
||||
if not player.is_playing:
|
||||
await player.play()
|
||||
@@ -255,14 +256,14 @@ class Music(commands.Cog):
|
||||
|
||||
@commands.command(name="skip", aliases=["next"])
|
||||
async def skip(self, ctx: Context):
|
||||
"""I heard this song way too often"""
|
||||
"""Skip the current song"""
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
await player.skip()
|
||||
await ctx.send("Skipped current song")
|
||||
|
||||
@commands.command(name="queue")
|
||||
@commands.command(name="queue", aliases=["q"])
|
||||
async def queue(self, ctx: Context):
|
||||
"""Ghetto queue"""
|
||||
"""Display the current radio queue"""
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
|
||||
embed_color = self.bot.colors["embed"]
|
||||
@@ -280,7 +281,7 @@ class Music(commands.Cog):
|
||||
|
||||
@commands.command(name="disconnect", aliases=["dc", "stop"])
|
||||
async def disconnect(self, ctx: Context):
|
||||
"""Disconnects ChristmasBot"""
|
||||
"""Disconnects the radio from the channel"""
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
|
||||
if not ctx.author.voice or (
|
||||
|
||||
Reference in New Issue
Block a user