mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
* [V3 Mod] Use a composite class for mod This turns mod.py into acomposite class I've split things in this up based on purpose, including `movetocore` `movetocore` is a set of things which likely belong in the core bot and not relying on mod being loaded. This is part of #2500 Per discussion in discord, this should be the first thing in #2500 merged * Move this back, mod was importable, and this was intended as non-breaking * Prevent fix from being lost if merged before this. see Cog-Creators/Red-DiscordBot#2510 * Move case creation to before sending see #2515 * fix failed merge done in web
34 lines
917 B
Python
34 lines
917 B
Python
from abc import ABC, abstractmethod
|
|
from typing import List, Tuple
|
|
|
|
import discord
|
|
from redbot.core import Config
|
|
from redbot.core.bot import Red
|
|
|
|
|
|
class MixinMeta(ABC):
|
|
"""
|
|
Metaclass for well behaved type hint detection with composite class.
|
|
|
|
Basically, to keep developers sane when not all attributes are defined in each mixin.
|
|
"""
|
|
|
|
def __init__(self, *_args):
|
|
self.settings: Config
|
|
self.bot: Red
|
|
self.cache: dict
|
|
self.ban_queue: List[Tuple[int, int]]
|
|
self.unban_queue: List[Tuple[int, int]]
|
|
|
|
@classmethod
|
|
@abstractmethod
|
|
async def get_audit_entry_info(
|
|
cls, guild: discord.Guild, action: discord.AuditLogAction, target
|
|
):
|
|
raise NotImplementedError()
|
|
|
|
@staticmethod
|
|
@abstractmethod
|
|
async def get_audit_log_entry(guild: discord.Guild, action: discord.AuditLogAction, target):
|
|
raise NotImplementedError()
|