mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-06 02:01:26 +03:00
minor improvements
This commit is contained in:
@@ -25,14 +25,18 @@ module.exports = class FeedbackModal extends Modal {
|
||||
let rating = parseInt(interaction.fields.getTextInputValue('rating')) || null; // any integer, or null if NaN
|
||||
rating = Math.min(Math.max(rating, 1), 5); // clamp between 1 and 5 (0 and null become 1, 6 becomes 5)
|
||||
|
||||
const data = {
|
||||
comment: comment?.length > 0 ? encrypt(comment) : null,
|
||||
guild: { connect: { id: interaction.guild.id } },
|
||||
rating,
|
||||
user: { connect: { id: interaction.user.id } },
|
||||
};
|
||||
const ticket = await client.prisma.ticket.update({
|
||||
data: {
|
||||
feedback: {
|
||||
create: {
|
||||
comment: comment?.length > 0 ? encrypt(comment) : null,
|
||||
guild: { connect: { id: interaction.guild.id } },
|
||||
rating,
|
||||
user: { connect: { id: interaction.user.id } },
|
||||
upsert: {
|
||||
create: data,
|
||||
update: data,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user