Compare commits

..

4 commits

3 changed files with 13 additions and 13 deletions

View file

@ -7,4 +7,6 @@
too-many-arguments, too-many-arguments,
too-many-branches, too-many-branches,
superfluous-parens, superfluous-parens,
invalid-name invalid-name,
too-many-locals,
too-many-public-methods

View file

@ -55,7 +55,7 @@ class Forums(commands.Cog):
self.config = Config.get_conf(None, cog_name='Forums', identifier=2352711325) self.config = Config.get_conf(None, cog_name='Forums', identifier=2352711325)
@ui.button(label="Yes", style=discord.ButtonStyle.success, emoji="") @ui.button(label="Yes", style=discord.ButtonStyle.success, emoji="")
async def resolved_button_yes(self, interaction: discord.Interaction, button: ui.Button): async def resolved_button_yes(self, interaction: discord.Interaction, button: ui.Button): # pylint: disable=unused-variable
request_role_ids = await self.config.guild(interaction.guild).request_roles() request_role_ids = await self.config.guild(interaction.guild).request_roles()
request_roles = [interaction.guild.get_role(role_id) for role_id in request_role_ids] request_roles = [interaction.guild.get_role(role_id) for role_id in request_role_ids]
match = any(role in interaction.user.roles for role in request_roles) match = any(role in interaction.user.roles for role in request_roles)
@ -78,7 +78,7 @@ class Forums(commands.Cog):
await interaction.response.send_message(content="You cannot close this thread!", ephemeral=True) await interaction.response.send_message(content="You cannot close this thread!", ephemeral=True)
@ui.button(label="No", style=discord.ButtonStyle.danger, emoji="✖️") @ui.button(label="No", style=discord.ButtonStyle.danger, emoji="✖️")
async def resolved_button_no(self, interaction: discord.Interaction, button: ui.Button): async def resolved_button_no(self, interaction: discord.Interaction, button: ui.Button): # pylint: disable=unused-variable
request_role_ids = await self.config.guild(interaction.guild).request_roles() request_role_ids = await self.config.guild(interaction.guild).request_roles()
request_roles = [interaction.guild.get_role(role_id) for role_id in request_role_ids] request_roles = [interaction.guild.get_role(role_id) for role_id in request_role_ids]
match = any(role in interaction.user.roles for role in request_roles) match = any(role in interaction.user.roles for role in request_roles)
@ -143,7 +143,6 @@ class Forums(commands.Cog):
if role: if role:
if role.id in current_list: if role.id in current_list:
await ctx.send("This role is already in the allowed roles list!") await ctx.send("This role is already in the allowed roles list!")
return
else: else:
current_list.append(role.id) current_list.append(role.id)
await self.config.guild(ctx.guild).request_roles.set(current_list) await self.config.guild(ctx.guild).request_roles.set(current_list)
@ -187,7 +186,7 @@ class Forums(commands.Cog):
msg = await ctx.reply("Select a forum tag below.") msg = await ctx.reply("Select a forum tag below.")
await msg.edit(view=SelectView(msg, options)) await msg.edit(view=SelectView(msg, options))
else: else:
await ctx.reply(f"Configuration error! Channel does not exist.") await ctx.reply("Configuration error! Channel does not exist.")
class Select(ui.Select): class Select(ui.Select):
def __init__(self, message, options): def __init__(self, message, options):

View file

@ -101,7 +101,6 @@ class Galaxy(commands.Cog):
match = re.search(r'(?<=:)\d+(?=>)', input_string) match = re.search(r'(?<=:)\d+(?=>)', input_string)
if match: if match:
return int(match.group()) return int(match.group())
else:
return input_string return input_string
@autoreact.command(name="emoji") @autoreact.command(name="emoji")
@ -121,14 +120,14 @@ class Galaxy(commands.Cog):
emoji_obj = emoji_to_find emoji_obj = emoji_to_find
break break
else: else:
await interaction.response.send_message(content=f"You're trying to set the autoreact emoji to an emoji I don't have access to!", ephemeral=True) await interaction.response.send_message(content="You're trying to set the autoreact emoji to an emoji I don't have access to!", ephemeral=True)
return return
await self.config.guild(interaction.guild).autoreact_emoji.set(emoji_obj.id) await self.config.guild(interaction.guild).autoreact_emoji.set(emoji_obj.id)
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact's emoji has been set to {emoji_obj} ({emoji_obj.id}).") embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact's emoji has been set to {emoji_obj} ({emoji_obj.id}).")
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
else: else:
await self.config.guild(interaction.guild).autoreact_emoji.set('💀') await self.config.guild(interaction.guild).autoreact_emoji.set('💀')
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact's emoji has been set to 💀.") embed=discord.Embed(color=await self.bot.get_embed_color(None), description="Autoreact's emoji has been set to 💀.")
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
@autoreact.command(name="set") @autoreact.command(name="set")
@ -146,7 +145,7 @@ class Galaxy(commands.Cog):
async def autoreact_reset(self, interaction: discord.Interaction): async def autoreact_reset(self, interaction: discord.Interaction):
"""Resets Autoreact's target.""" """Resets Autoreact's target."""
await self.config.guild(interaction.guild).autoreact_target.set(0) await self.config.guild(interaction.guild).autoreact_target.set(0)
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact's target has been reset.") embed=discord.Embed(color=await self.bot.get_embed_color(None), description="Autoreact's target has been reset.")
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
@commands.command() @commands.command()
@ -189,8 +188,8 @@ class Galaxy(commands.Cog):
} }
try: try:
insurance_dict[f'{ship_class}'] insurance_dict[f'{ship_class}']
except KeyError: except KeyError as error:
raise ValueError("Received value is not a valid ship class!") raise ValueError("Received value is not a valid ship class!") from error
if ship_class == "super_capital": if ship_class == "super_capital":
humanized_class = ship_class.replace("_", " ").title() humanized_class = ship_class.replace("_", " ").title()
else: else:
@ -348,7 +347,7 @@ class Galaxy(commands.Cog):
@warehouse.error @warehouse.error
@unix.error @unix.error
async def faq_handler(self, ctx, error): async def faq_handler(self, error):
"""Error Handler for Galaxy.""" """Error Handler for Galaxy."""
if isinstance(error, discord.NotFound): if isinstance(error, discord.NotFound):
return return