Files
TuneBot/context.py
T

16 lines
506 B
Python

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.")