forked from blizzthewolf/SeaCogs
fix(moderation): pylint fixes
This commit is contained in:
parent
e77a7c9553
commit
31fa5eb937
5 changed files with 13 additions and 4 deletions
|
@ -13,4 +13,5 @@
|
||||||
too-many-public-methods,
|
too-many-public-methods,
|
||||||
too-many-statements,
|
too-many-statements,
|
||||||
arguments-differ,
|
arguments-differ,
|
||||||
too-many-return-statements
|
too-many-return-statements,
|
||||||
|
import-outside-toplevel
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# pylint: disable=cyclic-import
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# pylint: disable=cyclic-import
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import humanize
|
import humanize
|
||||||
from discord import Color, Embed, Guild, Interaction, InteractionMessage
|
from discord import Color, Embed, Guild, Interaction, InteractionMessage
|
||||||
|
|
|
@ -762,7 +762,7 @@ class Moderation(commands.Cog):
|
||||||
cursor.execute(resolve_query, (json.dumps(changes), interaction.user.id, reason, case_dict['moderation_id']))
|
cursor.execute(resolve_query, (json.dumps(changes), interaction.user.id, reason, case_dict['moderation_id']))
|
||||||
database.commit()
|
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 interaction.response.send_message(content=f"✅ Moderation #{case:,} resolved!", embed=embed)
|
||||||
await log(interaction, case)
|
await log(interaction, case)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
# pylint: disable=cyclic-import
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from typing import Union
|
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 discord.errors import NotFound, Forbidden
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from .config import config
|
from .config import config
|
||||||
from .database import connect, fetch_case
|
|
||||||
|
|
||||||
|
|
||||||
async def check_conf(config_list: list):
|
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):
|
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."""
|
"""This method returns the next case number from the MySQL table for a specific guild."""
|
||||||
|
from .database import connect
|
||||||
|
|
||||||
if not cursor:
|
if not cursor:
|
||||||
database = await connect()
|
database = await connect()
|
||||||
cursor = database.cursor()
|
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):
|
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."""
|
"""This method sends a message to the guild's configured logging channel when an infraction takes place."""
|
||||||
from .embed_factory import embed_factory
|
from .embed_factory import embed_factory
|
||||||
|
from .database import fetch_case
|
||||||
|
|
||||||
logging_channel_id = await config.guild(interaction.guild).log_channel()
|
logging_channel_id = await config.guild(interaction.guild).log_channel()
|
||||||
if logging_channel_id != " ":
|
if logging_channel_id != " ":
|
||||||
|
|
Loading…
Reference in a new issue