mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 22:57:48 +00:00
Merge branch 'dev' into player-context
This commit is contained in:
+10
-9
@@ -12,6 +12,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
|
||||
@@ -69,10 +70,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(
|
||||
@@ -113,7 +111,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
|
||||
|
||||
@@ -215,9 +212,13 @@ 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 = ctx.get_player()
|
||||
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:
|
||||
@@ -227,20 +228,20 @@ class Music(commands.Cog):
|
||||
|
||||
@commands.command(name="skip", aliases=["next"])
|
||||
async def skip(self, ctx: CustomContext):
|
||||
"""I heard this song way too often"""
|
||||
"""Skip the current song"""
|
||||
player = ctx.get_player()
|
||||
await player.skip()
|
||||
await ctx.send("Skipped current song")
|
||||
|
||||
@commands.command(name="queue")
|
||||
async def queue(self, ctx: CustomContext):
|
||||
"""Ghetto queue"""
|
||||
"""Display the current radio queue"""
|
||||
player = ctx.get_player()
|
||||
await EmbedGenerator.Message(ctx, "Queue:", player.queue)
|
||||
|
||||
@commands.command(name="disconnect", aliases=["dc", "stop"])
|
||||
async def disconnect(self, ctx: CustomContext):
|
||||
"""Disconnects ChristmasBot"""
|
||||
"""Disconnects the radio from the channel"""
|
||||
player = ctx.get_player()
|
||||
|
||||
if not player.is_connected:
|
||||
|
||||
Reference in New Issue
Block a user