fix(issues): pylint fixes
This commit is contained in:
parent
b1874b0161
commit
d2df32ddaf
2 changed files with 21 additions and 19 deletions
|
@ -39,11 +39,11 @@ class Issues(commands.Cog):
|
||||||
channel = self.bot.get_channel(await self.config.request_channel())
|
channel = self.bot.get_channel(await self.config.request_channel())
|
||||||
if channel is None:
|
if channel is None:
|
||||||
await original_interaction.edit_original_response(content="Command cancelled.", view=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:
|
try:
|
||||||
message = await channel.send(content=".")
|
message = await channel.send(content=".")
|
||||||
await message.edit(content="", embed=embed, view=self.IssueResponseButtons(channel, message.id, interaction.user))
|
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()
|
await interaction.response.defer()
|
||||||
except (discord.HTTPException, discord.Forbidden) as error:
|
except (discord.HTTPException, discord.Forbidden) as error:
|
||||||
await original_interaction.edit_original_response(content="Command cancelled.", view=None)
|
await original_interaction.edit_original_response(content="Command cancelled.", view=None)
|
||||||
|
@ -57,19 +57,19 @@ class Issues(commands.Cog):
|
||||||
self.original_interaction = original_interaction
|
self.original_interaction = original_interaction
|
||||||
|
|
||||||
@discord.ui.button(label="Bot Bug", style=discord.ButtonStyle.danger)
|
@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))
|
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)
|
@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))
|
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)
|
@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))
|
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)
|
@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))
|
await interaction.response.send_modal(modals.CogSuggestionModal(self.color, self.cog_instance, self.original_interaction))
|
||||||
|
|
||||||
class IssueConfigurationButton(discord.ui.View):
|
class IssueConfigurationButton(discord.ui.View):
|
||||||
|
@ -79,7 +79,7 @@ class Issues(commands.Cog):
|
||||||
self.ctx = ctx
|
self.ctx = ctx
|
||||||
|
|
||||||
@discord.ui.button(label="Change Configuration", style=discord.ButtonStyle.blurple, row=0)
|
@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))
|
await interaction.response.send_modal(modals.IssuesConfigurationModal(self.config, self.ctx))
|
||||||
|
|
||||||
class IssueResponseButtons(discord.ui.View):
|
class IssueResponseButtons(discord.ui.View):
|
||||||
|
@ -90,9 +90,9 @@ class Issues(commands.Cog):
|
||||||
self.user = user
|
self.user = user
|
||||||
|
|
||||||
@discord.ui.button(label="Approve", style=discord.ButtonStyle.green)
|
@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))
|
await interaction.response.send_modal(modals.IssueResponseModal(self.channel, self.message_id, self.user, True))
|
||||||
|
|
||||||
@discord.ui.button(label="Deny", style=discord.ButtonStyle.danger)
|
@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))
|
await interaction.response.send_modal(modals.IssueResponseModal(self.channel, self.message_id, self.user, False))
|
||||||
|
|
|
@ -2,6 +2,8 @@ import aiohttp
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config
|
from redbot.core import Config
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
|
|
||||||
#
|
#
|
||||||
# Misc. functions
|
# 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)]
|
[f"{name}\n{value}" for name, value in zip(field_names, field_values)]
|
||||||
)
|
)
|
||||||
|
|
||||||
async def fetch_labels():
|
# async def fetch_labels():
|
||||||
async with aiohttp.ClientSession(headers=headers) as session:
|
# 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:
|
# 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 = []
|
# label_list = []
|
||||||
for label in response.json():
|
# for label in response.json():
|
||||||
if label["name"] in desired_labels:
|
# if label["name"] in desired_labels:
|
||||||
label_list.append(label["id"])
|
# label_list.append(label["id"])
|
||||||
if label_list is None:
|
# if label_list is None:
|
||||||
print("Error! Labels are not properly configured on the target repository.")
|
# print("Error! Labels are not properly configured on the target repository.")
|
||||||
return await label_list
|
# return await label_list
|
||||||
|
|
||||||
issue_labels = None
|
issue_labels = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue