WIP: Moderation type registry #26
14 changed files with 55 additions and 61 deletions
|
@ -23,24 +23,22 @@ from redbot.core.commands.converter import parse_relativedelta, parse_timedelta
|
|||
from redbot.core.utils.chat_formatting import (box, error, humanize_list,
|
||||
humanize_timedelta, warning)
|
||||
|
||||
from aurora.importers.aurora import ImportAuroraView
|
||||
from aurora.importers.galacticbot import ImportGalacticBotView
|
||||
from aurora.menus.addrole import Addrole
|
||||
from aurora.menus.guild import Guild
|
||||
from aurora.menus.immune import Immune
|
||||
from aurora.menus.overrides import Overrides
|
||||
from aurora.models.change import Change
|
||||
from aurora.models.moderation import Moderation
|
||||
from aurora.utilities.config import config, register_config
|
||||
from aurora.utilities.database import connect, create_guild_table
|
||||
from aurora.utilities.factory import (addrole_embed, case_factory,
|
||||
changes_factory, evidenceformat_factory,
|
||||
guild_embed, immune_embed,
|
||||
message_factory, overrides_embed)
|
||||
|
||||
from aurora.utilities.json import dump
|
||||
from aurora.utilities.logger import logger
|
||||
from aurora.utilities.utils import (check_moddable, check_permissions,
|
||||
from .importers.aurora import ImportAuroraView
|
||||
from .importers.galacticbot import ImportGalacticBotView
|
||||
from .menus.addrole import Addrole
|
||||
from .menus.guild import Guild
|
||||
from .menus.immune import Immune
|
||||
from .menus.overrides import Overrides
|
||||
from .models.change import Change
|
||||
from .models.moderation import Moderation
|
||||
from .utilities.config import config, register_config
|
||||
from .utilities.database import connect, create_guild_table
|
||||
from .utilities.factory import (addrole_embed, case_factory, changes_factory,
|
||||
evidenceformat_factory, guild_embed,
|
||||
immune_embed, message_factory, overrides_embed)
|
||||
from .utilities.json import dump
|
||||
from .utilities.logger import logger
|
||||
from .utilities.utils import (check_moddable, check_permissions,
|
||||
get_footer_image, log, send_evidenceformat,
|
||||
timedelta_from_relativedelta)
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ from discord import ButtonStyle, Interaction, Message, ui
|
|||
from redbot.core import commands
|
||||
from redbot.core.utils.chat_formatting import box, warning
|
||||
|
||||
from aurora.models.moderation import Moderation
|
||||
from aurora.utilities.database import connect, create_guild_table
|
||||
from ..models.moderation import Moderation
|
||||
from ..utilities.database import connect, create_guild_table
|
||||
|
||||
|
||||
class ImportAuroraView(ui.View):
|
||||
|
|
|
@ -7,8 +7,8 @@ from discord import ButtonStyle, Interaction, Message, ui
|
|||
from redbot.core import commands
|
||||
from redbot.core.utils.chat_formatting import box, warning
|
||||
|
||||
from aurora.models.moderation import Change, Moderation
|
||||
from aurora.utilities.database import connect, create_guild_table
|
||||
from ..models.moderation import Change, Moderation
|
||||
from ..utilities.database import connect, create_guild_table
|
||||
|
||||
|
||||
class ImportGalacticBotView(ui.View):
|
||||
|
|
|
@ -2,8 +2,8 @@ from discord import ButtonStyle, Interaction, Message, ui
|
|||
from redbot.core import commands
|
||||
from redbot.core.utils.chat_formatting import error
|
||||
|
||||
from aurora.utilities.config import config
|
||||
from aurora.utilities.factory import addrole_embed
|
||||
from ..utilities.config import config
|
||||
from ..utilities.factory import addrole_embed
|
||||
|
||||
|
||||
class Addrole(ui.View):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
from redbot.core import commands
|
||||
|
||||
from aurora.utilities.config import config
|
||||
from aurora.utilities.factory import guild_embed
|
||||
from aurora.utilities.utils import create_pagesize_options
|
||||
from ..utilities.config import config
|
||||
from ..utilities.factory import guild_embed
|
||||
from ..utilities.utils import create_pagesize_options
|
||||
|
||||
|
||||
class Guild(ui.View):
|
||||
|
|
|
@ -2,8 +2,8 @@ from discord import ButtonStyle, Interaction, Message, ui
|
|||
from redbot.core import commands
|
||||
from redbot.core.utils.chat_formatting import error
|
||||
|
||||
from aurora.utilities.config import config
|
||||
from aurora.utilities.factory import immune_embed
|
||||
from ..utilities.config import config
|
||||
from ..utilities.factory import immune_embed
|
||||
|
||||
|
||||
class Immune(ui.View):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
from redbot.core import commands
|
||||
|
||||
from aurora.utilities.config import config
|
||||
from aurora.utilities.factory import overrides_embed
|
||||
from aurora.utilities.utils import create_pagesize_options
|
||||
from ..utilities.config import config
|
||||
from ..utilities.factory import overrides_embed
|
||||
from ..utilities.utils import create_pagesize_options
|
||||
|
||||
|
||||
class Overrides(ui.View):
|
||||
|
|
|
@ -4,9 +4,9 @@ from typing import Literal, Optional
|
|||
|
||||
from redbot.core.bot import Red
|
||||
|
||||
from aurora.models.base import AuroraBaseModel
|
||||
from aurora.models.partials import PartialUser
|
||||
from aurora.utilities.logger import logger
|
||||
from ..models.base import AuroraBaseModel
|
||||
from ..models.partials import PartialUser
|
||||
from ..utilities.logger import logger
|
||||
|
||||
|
||||
class Change(AuroraBaseModel):
|
||||
|
|
|
@ -8,11 +8,11 @@ import discord
|
|||
from discord import NotFound
|
||||
from redbot.core.bot import Red
|
||||
|
||||
from aurora.models.base import AuroraGuildModel
|
||||
from aurora.models.change import Change
|
||||
from aurora.models.partials import PartialChannel, PartialRole, PartialUser
|
||||
from aurora.utilities.logger import logger
|
||||
from aurora.utilities.utils import get_next_case_number
|
||||
from ..models.base import AuroraGuildModel
|
||||
from ..models.change import Change
|
||||
from ..models.partials import PartialChannel, PartialRole, PartialUser
|
||||
from ..utilities.logger import logger
|
||||
from ..utilities.utils import get_next_case_number
|
||||
|
||||
|
||||
class Moderation(AuroraGuildModel):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from discord import Forbidden, HTTPException, InvalidData, NotFound
|
||||
from redbot.core.bot import Red
|
||||
|
||||
from aurora.models.base import AuroraBaseModel, AuroraGuildModel
|
||||
from ..models.base import AuroraBaseModel, AuroraGuildModel
|
||||
|
||||
|
||||
class PartialUser(AuroraBaseModel):
|
||||
|
|
|
@ -5,7 +5,7 @@ import sqlite3
|
|||
from discord import Guild
|
||||
from redbot.core import data_manager
|
||||
|
||||
from aurora.utilities.logger import logger
|
||||
from .logger import logger
|
||||
|
||||
|
||||
def connect() -> sqlite3.Connection:
|
||||
|
|
|
@ -2,18 +2,14 @@
|
|||
from datetime import datetime, timedelta
|
||||
from typing import Union
|
||||
|
||||
from discord import (Color, Embed, Guild, Interaction, InteractionMessage,
|
||||
Member, Role, User)
|
||||
from discord import Color, Embed, Guild, Interaction, InteractionMessage, Member, Role, User
|
||||
from redbot.core import commands
|
||||
from redbot.core.utils.chat_formatting import (bold, box, error,
|
||||
humanize_timedelta, warning)
|
||||
|
||||
from aurora.models.moderation import Moderation
|
||||
from aurora.models.partials import PartialUser
|
||||
from aurora.utilities.config import config
|
||||
from aurora.utilities.utils import (get_bool_emoji, get_next_case_number,
|
||||
get_pagesize_str)
|
||||
from redbot.core.utils.chat_formatting import bold, box, error, humanize_timedelta, warning
|
||||
|
||||
from ..models.moderation import Moderation
|
||||
from ..models.partials import PartialUser
|
||||
from .config import config
|
||||
from .utils import get_bool_emoji, get_next_case_number, get_pagesize_str
|
||||
|
||||
async def message_factory(
|
||||
color: Color,
|
||||
|
|
|
@ -3,7 +3,7 @@ from datetime import datetime, timedelta
|
|||
|
||||
from redbot.core.bot import Red
|
||||
|
||||
from aurora.models.base import AuroraBaseModel
|
||||
from ..models.base import AuroraBaseModel
|
||||
|
||||
|
||||
class JSONEncoder(json.JSONEncoder):
|
||||
|
|
|
@ -8,7 +8,7 @@ from discord.errors import Forbidden
|
|||
from redbot.core import commands, data_manager
|
||||
from redbot.core.utils.chat_formatting import error
|
||||
|
||||
from aurora.utilities.config import config
|
||||
from ..utilities.config import config
|
||||
|
||||
|
||||
def check_permissions(
|
||||
|
@ -111,7 +111,7 @@ async def check_moddable(
|
|||
|
||||
def get_next_case_number(guild_id: str, cursor=None) -> int:
|
||||
"""This function returns the next case number from the MySQL table for a specific guild."""
|
||||
from aurora.utilities.database import connect
|
||||
from .database import connect
|
||||
|
||||
if not cursor:
|
||||
database = connect()
|
||||
|
@ -125,8 +125,8 @@ def get_next_case_number(guild_id: str, cursor=None) -> int:
|
|||
|
||||
async def log(interaction: Interaction, moderation_id: int, resolved: bool = False) -> None:
|
||||
"""This function sends a message to the guild's configured logging channel when an infraction takes place."""
|
||||
from aurora.models.moderation import Moderation
|
||||
from aurora.utilities.factory import log_factory
|
||||
from ..models.moderation import Moderation
|
||||
from .factory import log_factory
|
||||
|
||||
logging_channel_id = await config.guild(interaction.guild).log_channel()
|
||||
if logging_channel_id != " ":
|
||||
|
@ -147,8 +147,8 @@ async def log(interaction: Interaction, moderation_id: int, resolved: bool = Fal
|
|||
|
||||
async def send_evidenceformat(interaction: Interaction, moderation_id: int) -> None:
|
||||
"""This function sends an ephemeral message to the moderator who took the moderation action, with a pre-made codeblock for use in the mod-evidence channel."""
|
||||
from aurora.models.moderation import Moderation
|
||||
from aurora.utilities.factory import evidenceformat_factory
|
||||
from ..models.moderation import Moderation
|
||||
from .factory import evidenceformat_factory
|
||||
|
||||
send_evidence_bool = (
|
||||
await config.user(interaction.user).auto_evidenceformat()
|
||||
|
|
Loading…
Reference in a new issue