mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 11:40:12 +01:00
fix(feedback): wasnt working due to app commands
This commit is contained in:
@@ -17,31 +17,36 @@ class FeedbackForm(discord.ui.Modal, title="Feeedback"):
|
|||||||
self.stop()
|
self.stop()
|
||||||
|
|
||||||
def feedback_command():
|
def feedback_command():
|
||||||
@app_commands.command(
|
@commands.hybrid_command(
|
||||||
name="feedback", description="Submit a feedback for the owners of the bot"
|
name="feedback",
|
||||||
|
description="Submit a feedback for the owners of the bot"
|
||||||
)
|
)
|
||||||
async def feedback(self, interaction: discord.Interaction):
|
async def feedback(self, context):
|
||||||
feedback_form = FeedbackForm()
|
if getattr(context, "interaction", None):
|
||||||
await interaction.response.send_modal(feedback_form)
|
interaction = context.interaction
|
||||||
|
feedback_form = FeedbackForm()
|
||||||
|
await interaction.response.send_modal(feedback_form)
|
||||||
|
|
||||||
await feedback_form.wait()
|
await feedback_form.wait()
|
||||||
interaction = feedback_form.interaction
|
interaction = feedback_form.interaction
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
embed=discord.Embed(
|
embed=discord.Embed(
|
||||||
title="Thank You!",
|
title="Thank You!",
|
||||||
description="Your feedback has been submitted, the owners have been notified about it.",
|
description="Your feedback has been submitted, the owners have been notified about it.",
|
||||||
color=0x7289DA,
|
color=0x7289DA,
|
||||||
).set_author(name="Feedback System", icon_url="https://yes.nighty.works/raw/gSxqzV.png"),
|
).set_author(name="Feedback System", icon_url="https://yes.nighty.works/raw/gSxqzV.png"),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
app_owner = (await self.bot.application_info()).owner
|
app_owner = (await self.bot.application_info()).owner
|
||||||
await app_owner.send(
|
await app_owner.send(
|
||||||
embed=discord.Embed(
|
embed=discord.Embed(
|
||||||
title="New Feedback",
|
title="New Feedback",
|
||||||
description=f"{interaction.user} (<@{interaction.user.id}>) has submitted a new feedback:\n```\n{feedback_form.answer}\n```",
|
description=f"{interaction.user} (<@{interaction.user.id}>) has submitted a new feedback:\n```\n{feedback_form.answer}\n```",
|
||||||
color=0x7289DA,
|
color=0x7289DA,
|
||||||
).set_author(name="Feedback System", icon_url="https://yes.nighty.works/raw/gSxqzV.png")
|
).set_author(name="Feedback System", icon_url="https://yes.nighty.works/raw/gSxqzV.png")
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
await context.send("This command can only be used as a slash command. Please use `/general feedback` instead.")
|
||||||
|
|
||||||
return feedback
|
return feedback
|
||||||
Reference in New Issue
Block a user