Discord/classes/holo_bot.py

21 lines
654 B
Python
Raw Normal View History

2025-02-09 23:00:18 +01:00
import logging
from logging import Logger
2025-02-16 17:44:13 +01:00
from libbot.cache.classes import CacheMemcached, CacheRedis
from libbot.cache.manager import create_cache_client
2024-12-17 22:14:06 +01:00
from libbot.pycord.classes import PycordBot
2025-02-09 23:00:18 +01:00
logger: Logger = logging.getLogger(__name__)
2024-12-17 22:14:06 +01:00
class HoloBot(PycordBot):
2025-02-16 17:44:13 +01:00
cache: CacheMemcached | CacheRedis | None = None
2025-02-09 23:00:18 +01:00
2024-12-17 22:14:06 +01:00
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
2025-02-09 23:37:44 +01:00
self._set_cache_engine()
2025-02-09 23:00:18 +01:00
def _set_cache_engine(self) -> None:
if "cache" in self.config and self.config["cache"]["type"] is not None:
self.cache = create_cache_client(self.config, self.config["cache"]["type"])