misc(moderation): isort'd the cog
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 47s
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 47s
This commit is contained in:
parent
1aa630656c
commit
89facfe663
6 changed files with 26 additions and 14 deletions
|
@ -1,9 +1,12 @@
|
|||
from datetime import timedelta
|
||||
import json
|
||||
from datetime import timedelta
|
||||
|
||||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
from redbot.core import commands
|
||||
from discord import Message, ButtonStyle, Interaction, ui
|
||||
|
||||
from ..utilities.database import connect, create_guild_table, mysql_log
|
||||
|
||||
|
||||
class ImportGalacticBotView(ui.View):
|
||||
def __init__(self, timeout, ctx, message):
|
||||
super().__init__()
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from datetime import timedelta, datetime
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Dict
|
||||
|
||||
from discord import ButtonStyle, Interaction, Message, ui
|
||||
from redbot.core import commands
|
||||
from discord import Message, ButtonStyle, Interaction, ui
|
||||
|
||||
from ..utilities.database import connect, create_guild_table, mysql_log
|
||||
|
||||
|
||||
|
|
|
@ -6,26 +6,26 @@
|
|||
# |_____/ \___|\__,_|___/ \_/\_/ |_|_| |_| |_|_| |_| |_|\___|_|
|
||||
|
||||
import json
|
||||
import time
|
||||
import os
|
||||
import time
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
import discord
|
||||
import humanize
|
||||
import mysql.connector
|
||||
|
||||
from discord.ext import tasks
|
||||
from pytimeparse2 import disable_dateutil, parse
|
||||
from redbot.core import app_commands, checks, commands, data_manager
|
||||
from redbot.core.app_commands import Choice
|
||||
|
||||
from .importers.galacticbot import ImportGalacticBotView
|
||||
from .importers.moderation import ImportModerationView
|
||||
from .utilities.config import config, register_config
|
||||
from .utilities.database import connect, create_guild_table, fetch_case, mysql_log
|
||||
from .utilities.embed_factory import embed_factory
|
||||
from .utilities.logger import logger
|
||||
from .utilities.utils import check_conf, check_permissions, check_moddable, fetch_channel_dict, fetch_user_dict, generate_dict, log
|
||||
from .importers.galacticbot import ImportGalacticBotView
|
||||
from .importers.moderation import ImportModerationView
|
||||
from .utilities.utils import check_conf, check_moddable, check_permissions, fetch_channel_dict, fetch_user_dict, generate_dict, log
|
||||
|
||||
|
||||
class Moderation(commands.Cog):
|
||||
"""Custom moderation cog.
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
import json
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import mysql.connector
|
||||
from discord import Guild
|
||||
from .utils import generate_dict, get_next_case_number, check_conf
|
||||
|
||||
from .config import config
|
||||
from .logger import logger
|
||||
from .utils import check_conf, generate_dict, get_next_case_number
|
||||
|
||||
|
||||
async def connect():
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
# pylint: disable=cyclic-import
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import humanize
|
||||
from discord import Color, Embed, Guild, Interaction, InteractionMessage
|
||||
from .utils import get_next_case_number, fetch_user_dict, fetch_channel_dict
|
||||
|
||||
from .utils import fetch_channel_dict, fetch_user_dict, get_next_case_number
|
||||
|
||||
|
||||
async def embed_factory(embed_type: str, color: Color, /, interaction: Interaction = None, case_dict: dict = None, guild: Guild = None, reason: str = None, moderation_type: str = None, response: InteractionMessage = None, duration: timedelta = None, resolved: bool = False):
|
||||
"""This method creates an embed from set parameters, meant for either moderation logging or contacting the moderated user.
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
import json
|
||||
from typing import Union
|
||||
from discord import User, Member, Interaction, Guild
|
||||
from discord.errors import NotFound, Forbidden
|
||||
|
||||
from discord import Guild, Interaction, Member, User
|
||||
from discord.errors import Forbidden, NotFound
|
||||
from redbot.core import commands
|
||||
|
||||
from .config import config
|
||||
|
||||
|
||||
|
@ -199,8 +201,8 @@ async def fetch_role_dict(interaction: Interaction, role_id: str):
|
|||
|
||||
async def log(interaction: Interaction, moderation_id: int, resolved: bool = False):
|
||||
"""This method sends a message to the guild's configured logging channel when an infraction takes place."""
|
||||
from .embed_factory import embed_factory
|
||||
from .database import fetch_case
|
||||
from .embed_factory import embed_factory
|
||||
|
||||
logging_channel_id = await config.guild(interaction.guild).log_channel()
|
||||
if logging_channel_id != " ":
|
||||
|
|
Loading…
Reference in a new issue