mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-17 17:23:08 +02:00
Select menu question type and finally fix logging diff
This commit is contained in:
parent
3a9483dbfb
commit
cc97a58165
@ -70,6 +70,8 @@ model Category {
|
|||||||
channelName String
|
channelName String
|
||||||
claiming Boolean @default(false)
|
claiming Boolean @default(false)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
cooldown Int?
|
||||||
|
customTopic String?
|
||||||
description String
|
description String
|
||||||
discordCategory String @db.VarChar(19)
|
discordCategory String @db.VarChar(19)
|
||||||
emoji String
|
emoji String
|
||||||
@ -142,10 +144,12 @@ model Question {
|
|||||||
label String @db.VarChar(45)
|
label String @db.VarChar(45)
|
||||||
maxLength Int? @default(4000)
|
maxLength Int? @default(4000)
|
||||||
minLength Int? @default(0)
|
minLength Int? @default(0)
|
||||||
|
options Json @default("[]")
|
||||||
order Int
|
order Int
|
||||||
placeholder String? @db.VarChar(100)
|
placeholder String? @db.VarChar(100)
|
||||||
required Boolean @default(true)
|
required Boolean @default(true)
|
||||||
style Int @default(2)
|
style Int @default(2)
|
||||||
|
type QuestionType @default(TEXT)
|
||||||
value String? @db.Text
|
value String? @db.Text
|
||||||
|
|
||||||
@@map("questions")
|
@@map("questions")
|
||||||
@ -207,7 +211,7 @@ model Ticket {
|
|||||||
open Boolean @default(true)
|
open Boolean @default(true)
|
||||||
openingMessage String @db.VarChar(19)
|
openingMessage String @db.VarChar(19)
|
||||||
pinnedMessages Json @default("[]")
|
pinnedMessages Json @default("[]")
|
||||||
priority Priority?
|
priority TicketPriority?
|
||||||
referencedBy Ticket[] @relation("TicketsReferencedByTicket")
|
referencedBy Ticket[] @relation("TicketsReferencedByTicket")
|
||||||
referencesMessageId String @db.VarChar(19)
|
referencesMessageId String @db.VarChar(19)
|
||||||
referencesTicket Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesTicketId], references: [id], onDelete: SetNull)
|
referencesTicket Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesTicketId], references: [id], onDelete: SetNull)
|
||||||
@ -232,8 +236,13 @@ model User {
|
|||||||
@@map("users")
|
@@map("users")
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Priority {
|
enum TicketPriority {
|
||||||
LOW
|
LOW
|
||||||
MEDIUM
|
MEDIUM
|
||||||
HIGH
|
HIGH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum QuestionType {
|
||||||
|
MENU
|
||||||
|
TEXT
|
||||||
|
}
|
||||||
|
@ -4,8 +4,9 @@ const {
|
|||||||
} = require('discord.js');
|
} = require('discord.js');
|
||||||
const { diff: getDiff } = require('object-diffy');
|
const { diff: getDiff } = require('object-diffy');
|
||||||
|
|
||||||
|
const uuidRegex = /[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}/g;
|
||||||
|
|
||||||
const exists = thing => (typeof thing === 'string' && thing.length > 0) && (thing !== null && thing !== undefined);
|
const exists = thing => typeof thing === 'string' ? thing.length > 0 : thing !== null && thing !== undefined;
|
||||||
|
|
||||||
const arrToObj = obj => {
|
const arrToObj = obj => {
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
@ -29,7 +30,7 @@ function makeDiff({
|
|||||||
const to = exists(diff[key].to) ? `+ ${String(diff[key].to).replace(/\n/g, '\\n')}\n` : '';
|
const to = exists(diff[key].to) ? `+ ${String(diff[key].to).replace(/\n/g, '\\n')}\n` : '';
|
||||||
fields.push({
|
fields.push({
|
||||||
inline: true,
|
inline: true,
|
||||||
name: key,
|
name: key.replace(uuidRegex, $1 => $1.split('-')[0]),
|
||||||
value: `\`\`\`diff\n${cleanCodeBlockContent(from + to)}\n\`\`\``,
|
value: `\`\`\`diff\n${cleanCodeBlockContent(from + to)}\n\`\`\``,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,12 @@ module.exports.get = fastify => ({
|
|||||||
label: true,
|
label: true,
|
||||||
maxLength: true,
|
maxLength: true,
|
||||||
minLength: true,
|
minLength: true,
|
||||||
|
options: true,
|
||||||
order: true,
|
order: true,
|
||||||
placeholder: true,
|
placeholder: true,
|
||||||
required: true,
|
required: true,
|
||||||
style: true,
|
style: true,
|
||||||
|
type: true,
|
||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -91,10 +93,12 @@ module.exports.patch = fastify => ({
|
|||||||
label: true,
|
label: true,
|
||||||
maxLength: true,
|
maxLength: true,
|
||||||
minLength: true,
|
minLength: true,
|
||||||
|
options: true,
|
||||||
order: true,
|
order: true,
|
||||||
placeholder: true,
|
placeholder: true,
|
||||||
required: true,
|
required: true,
|
||||||
style: true,
|
style: true,
|
||||||
|
type: true,
|
||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -19,6 +19,7 @@ module.exports.get = () => ({
|
|||||||
avatar: client.user.avatarURL(),
|
avatar: client.user.avatarURL(),
|
||||||
discriminator: client.user.discriminator,
|
discriminator: client.user.discriminator,
|
||||||
id: client.user.id,
|
id: client.user.id,
|
||||||
|
portal: process.env.PORTAL || null,
|
||||||
stats: {
|
stats: {
|
||||||
activatedUsers: users.length,
|
activatedUsers: users.length,
|
||||||
archivedMessages: users.reduce((total, user) => total + user.messageCount, 0), // don't count archivedMessage table rows, they get deleted
|
archivedMessages: users.reduce((total, user) => total + user.messageCount, 0), // don't count archivedMessage table rows, they get deleted
|
||||||
|
Loading…
Reference in New Issue
Block a user