mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 19:57:48 +00:00
Migrated settings cog
This commit is contained in:
@@ -12,7 +12,6 @@ import lavalink
|
||||
from aioredis import Redis
|
||||
from aioredis.client import Redis
|
||||
from discord import ActivityType
|
||||
from discord import app_commands
|
||||
from discord import Message
|
||||
from discord.colour import Color
|
||||
from discord.ext import commands
|
||||
@@ -23,6 +22,8 @@ from discord.ext.commands.errors import ExtensionNotFound
|
||||
from discord.ext.commands.errors import NoEntryPointError
|
||||
|
||||
from context import CustomContext
|
||||
from tunebot.redis import RedisPlaylistSource
|
||||
from tunebot.redis import RedisAutoJoin
|
||||
from tunebot.redis import GlobalRedisAutoJoin
|
||||
from tunebot.redis import GlobalRedisPlaylist
|
||||
from tunebot.redis import GlobalRedisPlaylistSource
|
||||
@@ -30,9 +31,12 @@ from utils.assets import process_colours
|
||||
from utils.log import logger
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from tunebot import AutoJoin
|
||||
from tunebot import PlaylistSource
|
||||
from tunebot import GlobalPlaylist
|
||||
from tunebot import GlobalPlaylistSource
|
||||
from tunebot import GlobalAutoJoin
|
||||
from tunebot.context import ContextLike
|
||||
|
||||
|
||||
config_path = "config.json"
|
||||
@@ -136,6 +140,12 @@ class TuneBot(commands.Bot):
|
||||
async def get_context(self, message: Message, *, cls=CustomContext):
|
||||
return await super().get_context(message, cls=cls)
|
||||
|
||||
def autojoin_context(self, ctx: "ContextLike") -> "AutoJoin":
|
||||
return RedisAutoJoin(ctx)
|
||||
|
||||
def playlist_source_context(self, ctx: "ContextLike") -> "PlaylistSource":
|
||||
return RedisPlaylistSource(ctx)
|
||||
|
||||
@tasks.loop(seconds=30)
|
||||
async def update_status(self):
|
||||
await self.wait_until_ready()
|
||||
|
||||
Reference in New Issue
Block a user