mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
[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
This commit is contained in:
33
redbot/cogs/mod/abc.py
Normal file
33
redbot/cogs/mod/abc.py
Normal file
@@ -0,0 +1,33 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user