mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 20:47:44 +00:00
decoupled lavalink creation from cogs.music
This commit is contained in:
+5
-1
@@ -8,16 +8,20 @@ from lavalink.models import DefaultPlayer
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from bot import TuneBot
|
||||
from utils.classes import BaseCog
|
||||
|
||||
|
||||
class CustomContext(commands.Context):
|
||||
bot: "TuneBot"
|
||||
cog: "BaseCog"
|
||||
|
||||
@property
|
||||
def redis(self) -> Redis:
|
||||
return self.bot._redis_client
|
||||
|
||||
@property
|
||||
def player(self) -> DefaultPlayer:
|
||||
if hasattr(self.bot, "lavalink"):
|
||||
if self.cog.is_lavalink_ready():
|
||||
return self.bot.lavalink.player_manager.get(self.guild.id)
|
||||
|
||||
raise CommandInvokeError("Lavalink is still starting up.")
|
||||
|
||||
Reference in New Issue
Block a user