mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 22:57:48 +00:00
Added context shortcut to get the lavalink player
This commit is contained in:
+7
-7
@@ -217,7 +217,7 @@ class Music(commands.Cog):
|
||||
async def play(self, ctx: CustomContext):
|
||||
"""Starts playing Christmas bangers"""
|
||||
# Get the player for this guild from cache.
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
player = ctx.get_player()
|
||||
await self.fill_player_queue(player, self.bot.config["queue_buffer_size"])
|
||||
|
||||
if not player.is_playing:
|
||||
@@ -226,22 +226,22 @@ class Music(commands.Cog):
|
||||
await ctx.send("Started playing")
|
||||
|
||||
@commands.command(name="skip", aliases=["next"])
|
||||
async def skip(self, ctx: Context):
|
||||
async def skip(self, ctx: CustomContext):
|
||||
"""I heard this song way too often"""
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
player = ctx.get_player()
|
||||
await player.skip()
|
||||
await ctx.send("Skipped current song")
|
||||
|
||||
@commands.command(name="queue")
|
||||
async def queue(self, ctx: Context):
|
||||
async def queue(self, ctx: CustomContext):
|
||||
"""Ghetto queue"""
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
player = ctx.get_player()
|
||||
await EmbedGenerator.Message(ctx, "Queue:", player.queue)
|
||||
|
||||
@commands.command(name="disconnect", aliases=["dc", "stop"])
|
||||
async def disconnect(self, ctx: Context):
|
||||
async def disconnect(self, ctx: CustomContext):
|
||||
"""Disconnects ChristmasBot"""
|
||||
player: DefaultPlayer = self.bot.lavalink.player_manager.get(ctx.guild.id)
|
||||
player = ctx.get_player()
|
||||
|
||||
if not player.is_connected:
|
||||
return await EmbedGenerator.Title(ctx, "Not connected.")
|
||||
|
||||
Reference in New Issue
Block a user