forked from cswimr/SeaCogs
fix(repo): ruff fixes / removing pylint exceptions
This commit is contained in:
parent
e34d621e6d
commit
858a1bae8a
12 changed files with 51 additions and 56 deletions
|
@ -84,7 +84,7 @@ class Aurora(commands.Cog):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
register_config(config)
|
register_config(config)
|
||||||
disable_dateutil()
|
disable_dateutil()
|
||||||
self.handle_expiry.start() # pylint: disable=no-member
|
self.handle_expiry.start()
|
||||||
|
|
||||||
async def cog_load(self):
|
async def cog_load(self):
|
||||||
"""This method prepares the database schema for all of the guilds the bot is currently in."""
|
"""This method prepares the database schema for all of the guilds the bot is currently in."""
|
||||||
|
@ -99,7 +99,7 @@ class Aurora(commands.Cog):
|
||||||
return
|
return
|
||||||
|
|
||||||
async def cog_unload(self):
|
async def cog_unload(self):
|
||||||
self.handle_expiry.cancel() # pylint: disable=no-member
|
self.handle_expiry.cancel()
|
||||||
|
|
||||||
@commands.Cog.listener("on_guild_join")
|
@commands.Cog.listener("on_guild_join")
|
||||||
async def db_generate_guild_join(self, guild: discord.Guild):
|
async def db_generate_guild_join(self, guild: discord.Guild):
|
||||||
|
|
|
@ -9,7 +9,6 @@ from redbot.core.utils.chat_formatting import box, warning
|
||||||
from ..utilities.database import connect, create_guild_table, mysql_log
|
from ..utilities.database import connect, create_guild_table, mysql_log
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=duplicate-code
|
|
||||||
class ImportAuroraView(ui.View):
|
class ImportAuroraView(ui.View):
|
||||||
def __init__(self, timeout, ctx, message):
|
def __init__(self, timeout, ctx, message):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -19,7 +18,7 @@ class ImportAuroraView(ui.View):
|
||||||
@ui.button(label="Yes", style=ButtonStyle.success)
|
@ui.button(label="Yes", style=ButtonStyle.success)
|
||||||
async def import_button_y(
|
async def import_button_y(
|
||||||
self, interaction: Interaction, button: ui.Button
|
self, interaction: Interaction, button: ui.Button
|
||||||
): # pylint: disable=unused-argument
|
):
|
||||||
await self.message.delete()
|
await self.message.delete()
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
"Deleting original table...", ephemeral=True
|
"Deleting original table...", ephemeral=True
|
||||||
|
@ -41,7 +40,7 @@ class ImportAuroraView(ui.View):
|
||||||
await interaction.edit_original_response(content="Importing moderations...")
|
await interaction.edit_original_response(content="Importing moderations...")
|
||||||
|
|
||||||
file = await self.ctx.message.attachments[0].read()
|
file = await self.ctx.message.attachments[0].read()
|
||||||
data: [dict] = sorted(json.loads(file), key=lambda x: x["moderation_id"])
|
data: list[dict] = sorted(json.loads(file), key=lambda x: x["moderation_id"])
|
||||||
|
|
||||||
user_mod_types = ["NOTE", "WARN", "MUTE", "UNMUTE", "KICK", "BAN", "UNBAN"]
|
user_mod_types = ["NOTE", "WARN", "MUTE", "UNMUTE", "KICK", "BAN", "UNBAN"]
|
||||||
|
|
||||||
|
@ -108,7 +107,7 @@ class ImportAuroraView(ui.View):
|
||||||
@ui.button(label="No", style=ButtonStyle.danger)
|
@ui.button(label="No", style=ButtonStyle.danger)
|
||||||
async def import_button_n(
|
async def import_button_n(
|
||||||
self, interaction: Interaction, button: ui.Button
|
self, interaction: Interaction, button: ui.Button
|
||||||
): # pylint: disable=unused-argument
|
):
|
||||||
await self.message.edit(content="Import cancelled.", view=None)
|
await self.message.edit(content="Import cancelled.", view=None)
|
||||||
await self.message.delete(10)
|
await self.message.delete(10)
|
||||||
await self.ctx.message.delete(10)
|
await self.ctx.message.delete(10)
|
||||||
|
|
|
@ -8,7 +8,6 @@ from redbot.core.utils.chat_formatting import box, warning
|
||||||
from ..utilities.database import connect, create_guild_table, mysql_log
|
from ..utilities.database import connect, create_guild_table, mysql_log
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=duplicate-code
|
|
||||||
class ImportGalacticBotView(ui.View):
|
class ImportGalacticBotView(ui.View):
|
||||||
def __init__(self, timeout, ctx, message):
|
def __init__(self, timeout, ctx, message):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -18,7 +17,7 @@ class ImportGalacticBotView(ui.View):
|
||||||
@ui.button(label="Yes", style=ButtonStyle.success)
|
@ui.button(label="Yes", style=ButtonStyle.success)
|
||||||
async def import_button_y(
|
async def import_button_y(
|
||||||
self, interaction: Interaction, button: ui.Button
|
self, interaction: Interaction, button: ui.Button
|
||||||
): # pylint: disable=unused-argument
|
):
|
||||||
await self.message.delete()
|
await self.message.delete()
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
"Deleting original table...", ephemeral=True
|
"Deleting original table...", ephemeral=True
|
||||||
|
@ -151,7 +150,7 @@ class ImportGalacticBotView(ui.View):
|
||||||
@ui.button(label="No", style=ButtonStyle.danger)
|
@ui.button(label="No", style=ButtonStyle.danger)
|
||||||
async def import_button_n(
|
async def import_button_n(
|
||||||
self, interaction: Interaction, button: ui.Button
|
self, interaction: Interaction, button: ui.Button
|
||||||
): # pylint: disable=unused-argument
|
):
|
||||||
await self.message.edit(content="Import cancelled.", view=None)
|
await self.message.edit(content="Import cancelled.", view=None)
|
||||||
await self.message.delete(10)
|
await self.message.delete(10)
|
||||||
await self.ctx.message.delete(10)
|
await self.ctx.message.delete(10)
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
from discord import ButtonStyle, ui, Interaction
|
from discord import ButtonStyle, Interaction, ui
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from redbot.core.utils.chat_formatting import error
|
from redbot.core.utils.chat_formatting import error
|
||||||
|
|
||||||
from aurora.utilities.factory import addrole_embed
|
|
||||||
from aurora.utilities.config import config
|
from aurora.utilities.config import config
|
||||||
|
from aurora.utilities.factory import addrole_embed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Addrole(ui.View):
|
class Addrole(ui.View):
|
||||||
def __init__(self, ctx: commands.Context):
|
def __init__(self, ctx: commands.Context):
|
||||||
|
@ -25,7 +27,7 @@ class Addrole(ui.View):
|
||||||
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
||||||
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def clear(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's addrole whitelist."), ephemeral=True)
|
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's addrole whitelist."), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -34,7 +36,7 @@ class Addrole(ui.View):
|
||||||
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Close", style=ButtonStyle.gray)
|
@ui.button(label="Close", style=ButtonStyle.gray)
|
||||||
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def close(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
from discord import ui, ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction, ui
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
|
|
||||||
|
from aurora.utilities.config import config
|
||||||
from aurora.utilities.factory import guild_embed
|
from aurora.utilities.factory import guild_embed
|
||||||
from aurora.utilities.utils import create_pagesize_options
|
from aurora.utilities.utils import create_pagesize_options
|
||||||
from aurora.utilities.config import config
|
|
||||||
|
|
||||||
|
|
||||||
class Guild(ui.View):
|
class Guild(ui.View):
|
||||||
def __init__(self, ctx: commands.Context):
|
def __init__(self, ctx: commands.Context):
|
||||||
|
@ -11,7 +13,7 @@ class Guild(ui.View):
|
||||||
self.ctx = ctx
|
self.ctx = ctx
|
||||||
|
|
||||||
@ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
|
@ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
|
||||||
async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def show_moderator(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -21,7 +23,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Use Discord Permissions", style=ButtonStyle.green, row=0)
|
@ui.button(label="Use Discord Permissions", style=ButtonStyle.green, row=0)
|
||||||
async def use_discord_permissions(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def use_discord_permissions(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -31,7 +33,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Ignore Modlog", style=ButtonStyle.green, row=0)
|
@ui.button(label="Ignore Modlog", style=ButtonStyle.green, row=0)
|
||||||
async def ignore_modlog(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def ignore_modlog(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -41,7 +43,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Ignore Other Bots", style=ButtonStyle.green, row=0)
|
@ui.button(label="Ignore Other Bots", style=ButtonStyle.green, row=0)
|
||||||
async def ignore_other_bots(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def ignore_other_bots(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -51,7 +53,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="DM Users", style=ButtonStyle.green, row=1)
|
@ui.button(label="DM Users", style=ButtonStyle.green, row=1)
|
||||||
async def dm_users(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def dm_users(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -61,7 +63,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=1)
|
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=1)
|
||||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -71,7 +73,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=1)
|
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=1)
|
||||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def ephemeral(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -81,7 +83,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="History Inline", style=ButtonStyle.green, row=1)
|
@ui.button(label="History Inline", style=ButtonStyle.green, row=1)
|
||||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def inline(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
from discord import ButtonStyle, ui, Interaction
|
from discord import ButtonStyle, Interaction, ui
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from redbot.core.utils.chat_formatting import error
|
from redbot.core.utils.chat_formatting import error
|
||||||
|
|
||||||
from aurora.utilities.factory import immune_embed
|
|
||||||
from aurora.utilities.config import config
|
from aurora.utilities.config import config
|
||||||
|
from aurora.utilities.factory import immune_embed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Immune(ui.View):
|
class Immune(ui.View):
|
||||||
def __init__(self, ctx: commands.Context):
|
def __init__(self, ctx: commands.Context):
|
||||||
|
@ -26,7 +28,7 @@ class Immune(ui.View):
|
||||||
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
||||||
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def clear(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's immune roles."), ephemeral=True)
|
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's immune roles."), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -35,7 +37,7 @@ class Immune(ui.View):
|
||||||
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Close", style=ButtonStyle.gray)
|
@ui.button(label="Close", style=ButtonStyle.gray)
|
||||||
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def close(self, interaction: Interaction, button: ui.Button):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
from discord import ui, ButtonStyle, Interaction
|
from discord import ButtonStyle, Interaction, ui
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
|
|
||||||
|
from aurora.utilities.config import config
|
||||||
from aurora.utilities.factory import overrides_embed
|
from aurora.utilities.factory import overrides_embed
|
||||||
from aurora.utilities.utils import create_pagesize_options
|
from aurora.utilities.utils import create_pagesize_options
|
||||||
from aurora.utilities.config import config
|
|
||||||
|
|
||||||
|
|
||||||
class Overrides(ui.View):
|
class Overrides(ui.View):
|
||||||
def __init__(self, ctx: commands.Context):
|
def __init__(self, ctx: commands.Context):
|
||||||
|
@ -11,7 +13,7 @@ class Overrides(ui.View):
|
||||||
self.ctx = ctx
|
self.ctx = ctx
|
||||||
|
|
||||||
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=0)
|
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=0)
|
||||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button):
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -26,7 +28,7 @@ class Overrides(ui.View):
|
||||||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
|
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
|
||||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def ephemeral(self, interaction: Interaction, button: ui.Button):
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -41,7 +43,7 @@ class Overrides(ui.View):
|
||||||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
|
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
|
||||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def inline(self, interaction: Interaction, button: ui.Button):
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
# pylint: disable=cyclic-import
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import time
|
import time
|
||||||
|
@ -87,8 +85,8 @@ async def create_guild_table(guild: Guild):
|
||||||
"NULL",
|
"NULL",
|
||||||
"NULL",
|
"NULL",
|
||||||
0,
|
0,
|
||||||
json.dumps([]), # pylint: disable=dangerous-default-value
|
json.dumps([]),
|
||||||
json.dumps({}), # pylint: disable=dangerous-default-value
|
json.dumps({}),
|
||||||
)
|
)
|
||||||
cursor.execute(insert_query, insert_values)
|
cursor.execute(insert_query, insert_values)
|
||||||
|
|
||||||
|
@ -104,7 +102,6 @@ async def create_guild_table(guild: Guild):
|
||||||
database.close()
|
database.close()
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=dangerous-default-value
|
|
||||||
async def mysql_log(
|
async def mysql_log(
|
||||||
guild_id: str,
|
guild_id: str,
|
||||||
author_id: str,
|
author_id: str,
|
||||||
|
|
|
@ -1,18 +1,13 @@
|
||||||
# pylint: disable=cyclic-import
|
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
import humanize
|
import humanize
|
||||||
from discord import (Color, Embed, Guild, Interaction, InteractionMessage,
|
from discord import Color, Embed, Guild, Interaction, InteractionMessage, Member, Role, User
|
||||||
Member, Role, User)
|
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from redbot.core.utils.chat_formatting import bold, box, error, warning
|
from redbot.core.utils.chat_formatting import bold, box, error, warning
|
||||||
|
|
||||||
from aurora.utilities.config import config
|
from aurora.utilities.config import config
|
||||||
from aurora.utilities.utils import (fetch_channel_dict, fetch_user_dict,
|
from aurora.utilities.utils import fetch_channel_dict, fetch_user_dict, get_bool_emoji, get_next_case_number, get_pagesize_str
|
||||||
get_bool_emoji, get_next_case_number,
|
|
||||||
get_pagesize_str)
|
|
||||||
|
|
||||||
|
|
||||||
async def message_factory(
|
async def message_factory(
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
# pylint: disable=cyclic-import
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from datetime import timedelta as td
|
from datetime import timedelta as td
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
|
@ -17,7 +17,6 @@ from redbot.core.bot import Red
|
||||||
from redbot.core.utils.chat_formatting import error, text_to_file
|
from redbot.core.utils.chat_formatting import error, text_to_file
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
class Backup(commands.Cog):
|
class Backup(commands.Cog):
|
||||||
"""A utility to make reinstalling repositories and cogs after migrating the bot far easier."""
|
"""A utility to make reinstalling repositories and cogs after migrating the bot far easier."""
|
||||||
|
|
||||||
|
@ -130,7 +129,7 @@ class Backup(commands.Cog):
|
||||||
try:
|
try:
|
||||||
repository = await downloader._repo_manager.add_repo(
|
repository = await downloader._repo_manager.add_repo(
|
||||||
url, name, branch
|
url, name, branch
|
||||||
) # pylint: disable=protected-access
|
)
|
||||||
repo_s.append(
|
repo_s.append(
|
||||||
f"Added repository {name} from {url} on branch {branch}."
|
f"Added repository {name} from {url} on branch {branch}."
|
||||||
)
|
)
|
||||||
|
@ -142,7 +141,7 @@ class Backup(commands.Cog):
|
||||||
repo_e.append(f"Repository {name} already exists.")
|
repo_e.append(f"Repository {name} already exists.")
|
||||||
repository = downloader._repo_manager.get_repo(
|
repository = downloader._repo_manager.get_repo(
|
||||||
name
|
name
|
||||||
) # pylint: disable=protected-access
|
)
|
||||||
self.logger.debug("Repository %s already exists", name)
|
self.logger.debug("Repository %s already exists", name)
|
||||||
|
|
||||||
# This is commented out because errors.AuthenticationError is not yet implemented in Red 3.5.5's Downloader cog.
|
# This is commented out because errors.AuthenticationError is not yet implemented in Red 3.5.5's Downloader cog.
|
||||||
|
@ -200,7 +199,7 @@ class Backup(commands.Cog):
|
||||||
await ctx.bot.remove_loaded_package(cog)
|
await ctx.bot.remove_loaded_package(cog)
|
||||||
await downloader._delete_cog(
|
await downloader._delete_cog(
|
||||||
poss_installed_path
|
poss_installed_path
|
||||||
) # pylint: disable=protected-access
|
)
|
||||||
uninstall_s.append(f"Uninstalled {cog}")
|
uninstall_s.append(f"Uninstalled {cog}")
|
||||||
self.logger.debug("Uninstalled %s", cog)
|
self.logger.debug("Uninstalled %s", cog)
|
||||||
else:
|
else:
|
||||||
|
@ -208,7 +207,7 @@ class Backup(commands.Cog):
|
||||||
self.logger.warning("Failed to uninstall %s", cog)
|
self.logger.warning("Failed to uninstall %s", cog)
|
||||||
await downloader._remove_from_installed(
|
await downloader._remove_from_installed(
|
||||||
cog_modules
|
cog_modules
|
||||||
) # pylint: disable=protected-access
|
)
|
||||||
|
|
||||||
for cog in cogs:
|
for cog in cogs:
|
||||||
cog_name = cog["name"]
|
cog_name = cog["name"]
|
||||||
|
@ -229,14 +228,14 @@ class Backup(commands.Cog):
|
||||||
await downloader._filter_incorrect_cogs_by_names(
|
await downloader._filter_incorrect_cogs_by_names(
|
||||||
repository, [cog_name]
|
repository, [cog_name]
|
||||||
)
|
)
|
||||||
) # pylint: disable=protected-access
|
)
|
||||||
if not cogs_c:
|
if not cogs_c:
|
||||||
install_e.append(message)
|
install_e.append(message)
|
||||||
self.logger.error(message)
|
self.logger.error(message)
|
||||||
continue
|
continue
|
||||||
failed_reqs = await downloader._install_requirements(
|
failed_reqs = await downloader._install_requirements(
|
||||||
cogs_c
|
cogs_c
|
||||||
) # pylint: disable=protected-access
|
)
|
||||||
if failed_reqs:
|
if failed_reqs:
|
||||||
install_e.append(
|
install_e.append(
|
||||||
f"Failed to install {cog_name} due to missing requirements: {failed_reqs}"
|
f"Failed to install {cog_name} due to missing requirements: {failed_reqs}"
|
||||||
|
@ -250,7 +249,7 @@ class Backup(commands.Cog):
|
||||||
|
|
||||||
installed_cogs, failed_cogs = await downloader._install_cogs(
|
installed_cogs, failed_cogs = await downloader._install_cogs(
|
||||||
cogs_c
|
cogs_c
|
||||||
) # pylint: disable=protected-access
|
)
|
||||||
|
|
||||||
if repository.available_libraries:
|
if repository.available_libraries:
|
||||||
installed_libs, failed_libs = (
|
installed_libs, failed_libs = (
|
||||||
|
@ -271,7 +270,7 @@ class Backup(commands.Cog):
|
||||||
installed_cogs + installed_libs
|
installed_cogs + installed_libs
|
||||||
if installed_libs
|
if installed_libs
|
||||||
else installed_cogs
|
else installed_cogs
|
||||||
) # pylint: disable=protected-access
|
)
|
||||||
if installed_cogs:
|
if installed_cogs:
|
||||||
installed_cog_name = installed_cogs[0].name
|
installed_cog_name = installed_cogs[0].name
|
||||||
install_s.append(f"Installed {installed_cog_name}")
|
install_s.append(f"Installed {installed_cog_name}")
|
||||||
|
|
|
@ -65,7 +65,7 @@ exclude = [
|
||||||
]
|
]
|
||||||
|
|
||||||
# Same as Black.
|
# Same as Black.
|
||||||
line-length = 300
|
line-length = 320
|
||||||
indent-width = 4
|
indent-width = 4
|
||||||
|
|
||||||
# Assume Python 3.11
|
# Assume Python 3.11
|
||||||
|
|
Loading…
Reference in a new issue