2025-09-14 18:54:56 -04:00
|
|
|
import discord
|
|
|
|
|
from discord import app_commands
|
|
|
|
|
from discord.ext import commands
|
|
|
|
|
|
2025-11-02 23:32:52 -05:00
|
|
|
|
2025-09-14 18:54:56 -04:00
|
|
|
class FeedbackForm(discord.ui.Modal, title="Feeedback"):
|
|
|
|
|
feedback = discord.ui.TextInput(
|
|
|
|
|
label="What do you think about this bot?",
|
|
|
|
|
style=discord.TextStyle.long,
|
|
|
|
|
placeholder="Type your answer here...",
|
|
|
|
|
required=True,
|
|
|
|
|
max_length=256,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
async def on_submit(self, interaction: discord.Interaction):
|
|
|
|
|
self.interaction = interaction
|
|
|
|
|
self.answer = str(self.feedback)
|
|
|
|
|
self.stop()
|
|
|
|
|
|
2025-11-02 23:32:52 -05:00
|
|
|
|
2025-09-28 22:53:25 -04:00
|
|
|
def feedback_command():
|
2025-10-04 20:21:10 -04:00
|
|
|
@commands.hybrid_command(
|
2025-11-02 23:32:52 -05:00
|
|
|
name="feedback", description="Submit a feedback for the owners of the bot"
|
2025-09-14 18:54:56 -04:00
|
|
|
)
|
2025-10-04 20:21:10 -04:00
|
|
|
async def feedback(self, context):
|
|
|
|
|
if getattr(context, "interaction", None):
|
|
|
|
|
interaction = context.interaction
|
|
|
|
|
feedback_form = FeedbackForm()
|
|
|
|
|
await interaction.response.send_modal(feedback_form)
|
2025-09-14 18:54:56 -04:00
|
|
|
|
2025-10-04 20:21:10 -04:00
|
|
|
await feedback_form.wait()
|
|
|
|
|
interaction = feedback_form.interaction
|
|
|
|
|
await interaction.response.send_message(
|
|
|
|
|
embed=discord.Embed(
|
|
|
|
|
title="Thank You!",
|
|
|
|
|
description="Your feedback has been submitted, the owners have been notified about it.",
|
|
|
|
|
color=0x7289DA,
|
2025-11-02 23:32:52 -05:00
|
|
|
).set_author(
|
|
|
|
|
name="Feedback System",
|
|
|
|
|
icon_url="https://yes.nighty.works/raw/gSxqzV.png",
|
|
|
|
|
),
|
2025-10-04 20:21:10 -04:00
|
|
|
ephemeral=True,
|
|
|
|
|
)
|
2025-09-14 18:54:56 -04:00
|
|
|
|
2025-10-04 20:21:10 -04:00
|
|
|
app_owner = (await self.bot.application_info()).owner
|
|
|
|
|
await app_owner.send(
|
|
|
|
|
embed=discord.Embed(
|
|
|
|
|
title="New Feedback",
|
|
|
|
|
description=f"{interaction.user} (<@{interaction.user.id}>) has submitted a new feedback:\n```\n{feedback_form.answer}\n```",
|
|
|
|
|
color=0x7289DA,
|
2025-11-02 23:32:52 -05:00
|
|
|
).set_author(
|
|
|
|
|
name="Feedback System",
|
|
|
|
|
icon_url="https://yes.nighty.works/raw/gSxqzV.png",
|
|
|
|
|
)
|
2025-10-04 20:21:10 -04:00
|
|
|
)
|
|
|
|
|
else:
|
2025-10-04 22:09:11 -04:00
|
|
|
embed = discord.Embed(
|
|
|
|
|
title="Error!",
|
|
|
|
|
description="This command can only be used as a slash command. Please use `/general feedback` instead.",
|
|
|
|
|
color=0xE02B2B,
|
|
|
|
|
)
|
2025-11-02 23:32:52 -05:00
|
|
|
embed.set_author(
|
|
|
|
|
name="Feedback System",
|
|
|
|
|
icon_url="https://yes.nighty.works/raw/gSxqzV.png",
|
|
|
|
|
)
|
2025-10-04 22:09:11 -04:00
|
|
|
await context.send(embed=embed)
|
2025-11-02 23:32:52 -05:00
|
|
|
|
|
|
|
|
return feedback
|