fix(issues): pylint fixes

This commit is contained in:
Seaswimmer 2023-09-24 17:16:32 -04:00
parent b1874b0161
commit d2df32ddaf
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8
2 changed files with 21 additions and 19 deletions

View file

@ -39,11 +39,11 @@ class Issues(commands.Cog):
channel = self.bot.get_channel(await self.config.request_channel())
if channel is None:
await original_interaction.edit_original_response(content="Command cancelled.", view=None)
await interaction.response.send_message(content=f"The cog is misconfigured, please report this error.", ephemeral=True)
await interaction.response.send_message(content="The cog is misconfigured, please report this error.", ephemeral=True)
try:
message = await channel.send(content=".")
await message.edit(content="", embed=embed, view=self.IssueResponseButtons(channel, message.id, interaction.user))
await original_interaction.edit_original_response(content=f"Issue request sent!", embed=embed, view=None)
await original_interaction.edit_original_response(content="Issue request sent!", embed=embed, view=None)
await interaction.response.defer()
except (discord.HTTPException, discord.Forbidden) as error:
await original_interaction.edit_original_response(content="Command cancelled.", view=None)
@ -57,19 +57,19 @@ class Issues(commands.Cog):
self.original_interaction = original_interaction
@discord.ui.button(label="Bot Bug", style=discord.ButtonStyle.danger)
async def issue_button_bot_bug(self, interaction: discord.Interaction, button: discord.ui.Button):
async def issue_button_bot_bug(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument
await interaction.response.send_modal(modals.BotBugModal(self.color, self.cog_instance, self.original_interaction))
@discord.ui.button(label="Cog Bug", style=discord.ButtonStyle.danger)
async def issue_button_cog_bug(self, interaction: discord.Interaction, button: discord.ui.Button):
async def issue_button_cog_bug(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument
await interaction.response.send_modal(modals.CogBugModal(self.color, self.cog_instance, self.original_interaction))
@discord.ui.button(label="Bot Suggestion", style=discord.ButtonStyle.blurple)
async def issue_button_bot_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button):
async def issue_button_bot_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument
await interaction.response.send_modal(modals.BotSuggestionModal(self.color, self.cog_instance, self.original_interaction))
@discord.ui.button(label="Cog Suggestion", style=discord.ButtonStyle.blurple)
async def issue_button_cog_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button):
async def issue_button_cog_suggestion(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument
await interaction.response.send_modal(modals.CogSuggestionModal(self.color, self.cog_instance, self.original_interaction))
class IssueConfigurationButton(discord.ui.View):
@ -79,7 +79,7 @@ class Issues(commands.Cog):
self.ctx = ctx
@discord.ui.button(label="Change Configuration", style=discord.ButtonStyle.blurple, row=0)
async def issue_configuration_button(self, interaction: discord.Interaction, button: discord.ui.Button):
async def issue_configuration_button(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument
await interaction.response.send_modal(modals.IssuesConfigurationModal(self.config, self.ctx))
class IssueResponseButtons(discord.ui.View):
@ -90,9 +90,9 @@ class Issues(commands.Cog):
self.user = user
@discord.ui.button(label="Approve", style=discord.ButtonStyle.green)
async def issue_response_button_approve(self, interaction: discord.Interaction, button: discord.ui.Button):
async def issue_response_button_approve(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument
await interaction.response.send_modal(modals.IssueResponseModal(self.channel, self.message_id, self.user, True))
@discord.ui.button(label="Deny", style=discord.ButtonStyle.danger)
async def issue_response_button_deny(self, interaction: discord.Interaction, button: discord.ui.Button):
async def issue_response_button_deny(self, interaction: discord.Interaction, button: discord.ui.Button): # pylint: disable=unused-argument
await interaction.response.send_modal(modals.IssueResponseModal(self.channel, self.message_id, self.user, False))

View file

@ -2,6 +2,8 @@ import aiohttp
import discord
from redbot.core import Config
# pylint: disable=arguments-differ
#
# Misc. functions
#
@ -297,16 +299,16 @@ class IssueResponseModal(discord.ui.Modal, title="Sending response message..."):
[f"{name}\n{value}" for name, value in zip(field_names, field_values)]
)
async def fetch_labels():
async with aiohttp.ClientSession(headers=headers) as session:
async with session.post(url=f"{await self.config.gitea_root_url()}/api/v1/repos/{await self.config.gitea_repository_owner()}/{await self.config.gitea_repository()}/labels") as response:
label_list = []
for label in response.json():
if label["name"] in desired_labels:
label_list.append(label["id"])
if label_list is None:
print("Error! Labels are not properly configured on the target repository.")
return await label_list
# async def fetch_labels():
# async with aiohttp.ClientSession(headers=headers) as session:
# async with session.post(url=f"{await self.config.gitea_root_url()}/api/v1/repos/{await self.config.gitea_repository_owner()}/{await self.config.gitea_repository()}/labels") as response:
# label_list = []
# for label in response.json():
# if label["name"] in desired_labels:
# label_list.append(label["id"])
# if label_list is None:
# print("Error! Labels are not properly configured on the target repository.")
# return await label_list
issue_labels = None