mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 19:57:48 +00:00
database rewrite
This commit is contained in:
@@ -4,6 +4,7 @@ from typing import Any
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Sequence
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import aioredis
|
||||
import discord
|
||||
@@ -21,6 +22,14 @@ from discord.ext.commands.errors import ExtensionNotFound
|
||||
from discord.ext.commands.errors import NoEntryPointError
|
||||
|
||||
from context import CustomContext
|
||||
from tunebot.redis import GlobalRedisAutoJoin
|
||||
from tunebot.redis import GlobalRedisPlaylist
|
||||
from tunebot.redis import GlobalRedisPlaylistSource
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from tunebot import GlobalPlaylist
|
||||
from tunebot import GlobalPlaylistSource
|
||||
from tunebot import GlobalAutoJoin
|
||||
|
||||
|
||||
class TuneBot(commands.Bot):
|
||||
@@ -39,9 +48,24 @@ class TuneBot(commands.Bot):
|
||||
self.initial_cog_names: List[str] = self.config.get("cogs", [])
|
||||
self.colors: Dict[str, Color] = self.process_colours(config.get("colors", []))
|
||||
|
||||
self.redis_prefix = self.config["redis_prefix"]
|
||||
self._redis_client: Redis = aioredis.from_url(
|
||||
self.config["redis_url"], encoding="utf-8", decode_responses=True
|
||||
)
|
||||
|
||||
self.global_autojoin: GlobalAutoJoin = GlobalRedisAutoJoin(
|
||||
self._redis_client,
|
||||
self.redis_prefix,
|
||||
)
|
||||
self.global_playlist: GlobalPlaylist = GlobalRedisPlaylist(
|
||||
self._redis_client,
|
||||
self.redis_prefix,
|
||||
)
|
||||
self.global_playlist_source: GlobalPlaylistSource = GlobalRedisPlaylistSource(
|
||||
self._redis_client,
|
||||
self.redis_prefix,
|
||||
)
|
||||
|
||||
self.invite_link: str = ""
|
||||
|
||||
slash_guilds = None
|
||||
|
||||
Reference in New Issue
Block a user