2022-08-02 20:03:55 +03:00
|
|
|
const { Modal } = require('@eartharoid/dbf');
|
|
|
|
|
|
|
|
module.exports = class FeedbackModal extends Modal {
|
|
|
|
constructor(client, options) {
|
|
|
|
super(client, {
|
|
|
|
...options,
|
|
|
|
id: 'feedback',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-01-13 22:48:37 +02:00
|
|
|
async run(id, interaction) {
|
|
|
|
/** @type {import("client")} */
|
|
|
|
const client = this.client;
|
|
|
|
|
|
|
|
await interaction.deferReply();
|
|
|
|
await client.prisma.ticket.update({
|
|
|
|
data: {
|
|
|
|
feedback: {
|
|
|
|
create: {
|
|
|
|
comment: interaction.fields.getTextInputValue('comment'),
|
|
|
|
guild: { connect: { id: interaction.guild.id } },
|
|
|
|
rating: parseInt(interaction.fields.getTextInputValue('rating')) || null,
|
|
|
|
user: { connect: { id: interaction.user.id } },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
where: { id: interaction.channel.id },
|
|
|
|
});
|
|
|
|
await client.tickets.requestClose(interaction, id.reason);
|
|
|
|
}
|
2022-08-02 20:03:55 +03:00
|
|
|
};
|