Michael H c7608aeb17 [V3 Mod] Use a composite class for mod (#2501)
* [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
2019-04-01 03:34:27 -08:00

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()