fix(moderation): pylint fixes

This commit is contained in:
Seaswimmer 2023-12-17 03:11:51 -05:00
parent e77a7c9553
commit 31fa5eb937
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE
5 changed files with 13 additions and 4 deletions

View file

@ -13,4 +13,5 @@
too-many-public-methods,
too-many-statements,
arguments-differ,
too-many-return-statements
too-many-return-statements,
import-outside-toplevel

View file

@ -1,3 +1,5 @@
# pylint: disable=cyclic-import
import json
import time
from datetime import datetime

View file

@ -1,3 +1,5 @@
# pylint: disable=cyclic-import
from datetime import datetime, timedelta
import humanize
from discord import Color, Embed, Guild, Interaction, InteractionMessage

View file

@ -762,7 +762,7 @@ class Moderation(commands.Cog):
cursor.execute(resolve_query, (json.dumps(changes), interaction.user.id, reason, case_dict['moderation_id']))
database.commit()
embed = await embed_factory('case', await self.bot.get_embed_color(None), interaction=interaction, case_dict=await self.fetch_case(case, interaction.guild.id))
embed = await embed_factory('case', await self.bot.get_embed_color(None), interaction=interaction, case_dict=await fetch_case(case, interaction.guild.id))
await interaction.response.send_message(content=f"✅ Moderation #{case:,} resolved!", embed=embed)
await log(interaction, case)

View file

@ -1,10 +1,11 @@
# pylint: disable=cyclic-import
import json
from typing import Union
from discord import Color, User, Member, Interaction, Guild
from discord import User, Member, Interaction, Guild
from discord.errors import NotFound, Forbidden
from redbot.core import commands
from .config import config
from .database import connect, fetch_case
async def check_conf(config_list: list):
@ -110,6 +111,8 @@ async def check_moddable(
async def get_next_case_number(guild_id: str, cursor=None):
"""This method returns the next case number from the MySQL table for a specific guild."""
from .database import connect
if not cursor:
database = await connect()
cursor = database.cursor()
@ -183,6 +186,7 @@ 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
logging_channel_id = await config.guild(interaction.guild).log_channel()
if logging_channel_id != " ":