mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 20:47:44 +00:00
Added aioredis + custom context
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import asyncio
|
||||
from aioredis.client import Redis
|
||||
import discord
|
||||
from discord.colour import Color
|
||||
from discord.ext import commands
|
||||
import sys
|
||||
from signal import SIGINT, SIGTERM
|
||||
import json
|
||||
from typing import Any, Dict, List, Sequence
|
||||
from discord import Message
|
||||
@@ -11,6 +14,10 @@ from discord.ext.commands.errors import (
|
||||
ExtensionNotFound,
|
||||
NoEntryPointError,
|
||||
)
|
||||
import aioredis
|
||||
from aioredis import Redis
|
||||
|
||||
from context import CustomContext
|
||||
|
||||
|
||||
class ChristmasBot(commands.Bot):
|
||||
@@ -23,6 +30,9 @@ class ChristmasBot(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_client: Redis = aioredis.from_url(
|
||||
self.config["redis_url"], encoding="utf-8", decode_responses=True
|
||||
)
|
||||
self.invite_link: str = ""
|
||||
|
||||
super().__init__(
|
||||
@@ -69,6 +79,9 @@ class ChristmasBot(commands.Bot):
|
||||
colour_dict[name] = Color(int(color, 16))
|
||||
return colour_dict
|
||||
|
||||
async def get_context(self, message: Message, *, cls=CustomContext):
|
||||
return await super().get_context(message, cls=cls)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user