mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 19:57:48 +00:00
Added context shortcut to get the lavalink player
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
from aioredis.client import Redis
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands.errors import CommandInvokeError
|
||||
from lavalink.models import DefaultPlayer
|
||||
|
||||
|
||||
class CustomContext(commands.Context):
|
||||
def get_redis(self) -> Redis:
|
||||
return self.bot._redis_client
|
||||
|
||||
def get_player(self) -> DefaultPlayer:
|
||||
if hasattr(self.bot, "lavalink"):
|
||||
return self.bot.lavalink.player_manager.get(self.guild.id)
|
||||
|
||||
raise CommandInvokeError("Lavalink is still starting up.")
|
||||
|
||||
Reference in New Issue
Block a user