fix(suggestions): fixed context commands preventing the cog from loading
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
This commit is contained in:
parent
84c3dd4413
commit
41e852b728
2 changed files with 18 additions and 9 deletions
|
@ -1,5 +1,14 @@
|
||||||
from .suggestions import Suggestions
|
from .suggestions import Suggestions, approve_context, deny_context
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
await bot.add_cog(Suggestions(bot))
|
await bot.add_cog(Suggestions(bot))
|
||||||
|
|
||||||
|
async def setup(bot):
|
||||||
|
bot.tree.add_command(approve_context)
|
||||||
|
bot.tree.add_command(deny_context)
|
||||||
|
|
||||||
|
async def teardown(bot):
|
||||||
|
# We're removing the commands here to ensure they get unloaded properly when the cog is unloaded.
|
||||||
|
bot.tree.remove_command("approve_context", type=discord.AppCommandType.message)
|
||||||
|
bot.tree.remove_command("deny_context", type=discord.AppCommandType.message)
|
||||||
|
|
|
@ -208,14 +208,6 @@ class Suggestions(commands.Cog):
|
||||||
await old_msg.edit(content=content, embed=embed)
|
await old_msg.edit(content=content, embed=embed)
|
||||||
await ctx.tick()
|
await ctx.tick()
|
||||||
|
|
||||||
@app_commands.context_menu(name="Approve Suggestion")
|
|
||||||
async def approve_context(self, interaction: discord.Interaction, message: discord.Message):
|
|
||||||
await interaction.response.send_modal(self.SuggestionApproveModal(self, message))
|
|
||||||
|
|
||||||
@app_commands.context_menu(name="Deny Suggestion")
|
|
||||||
async def deny_context(self, interaction: discord.Interaction, message: discord.Message):
|
|
||||||
await interaction.response.send_modal(self.SuggestionDenyModal(self, message))
|
|
||||||
|
|
||||||
@checks.admin()
|
@checks.admin()
|
||||||
@checks.bot_has_permissions(
|
@checks.bot_has_permissions(
|
||||||
manage_channels=True, add_reactions=True, manage_messages=True
|
manage_channels=True, add_reactions=True, manage_messages=True
|
||||||
|
@ -647,3 +639,11 @@ class Suggestions(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await self.cog_instance.interaction_finish_suggestion(interaction, self.message, False, None)
|
await self.cog_instance.interaction_finish_suggestion(interaction, self.message, False, None)
|
||||||
await interaction.response.send_message(content="Suggestion denied!", ephemeral=True)
|
await interaction.response.send_message(content="Suggestion denied!", ephemeral=True)
|
||||||
|
|
||||||
|
@app_commands.context_menu(name="Approve Suggestion")
|
||||||
|
async def approve_context(interaction: discord.Interaction, message: discord.Message):
|
||||||
|
await interaction.response.send_modal(Suggestions.SuggestionApproveModal(Suggestions, message))
|
||||||
|
|
||||||
|
@app_commands.context_menu(name="Deny Suggestion")
|
||||||
|
async def deny_context(interaction: discord.Interaction, message: discord.Message):
|
||||||
|
await interaction.response.send_modal(Suggestions.SuggestionDenyModal(Suggestions, message))
|
||||||
|
|
Loading…
Reference in a new issue