mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-06 02:01:26 +03:00
feat: improve error handling
This commit is contained in:
@@ -3,6 +3,11 @@ const {
|
||||
EmbedBuilder,
|
||||
} = require('discord.js');
|
||||
const { diff: getDiff } = require('object-diffy');
|
||||
const ShortUniqueId = require('short-unique-id');
|
||||
|
||||
const uid = new ShortUniqueId();
|
||||
|
||||
const getSUID = () => uid.stamp(10);
|
||||
|
||||
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;
|
||||
|
||||
@@ -235,6 +240,7 @@ async function logMessageEvent(client, {
|
||||
|
||||
module.exports = {
|
||||
getLogChannel,
|
||||
getSUID,
|
||||
logAdminEvent,
|
||||
logMessageEvent,
|
||||
logTicketEvent,
|
||||
|
@@ -28,6 +28,7 @@ const {
|
||||
decrypt,
|
||||
encrypt,
|
||||
} = new Cryptr(process.env.ENCRYPTION_KEY);
|
||||
const { getSUID } = require('../logging');
|
||||
|
||||
/**
|
||||
* @typedef {import('@prisma/client').Category &
|
||||
@@ -682,7 +683,7 @@ module.exports = class TicketManager {
|
||||
userId: interaction.user.id,
|
||||
});
|
||||
} catch (error) {
|
||||
const ref = require('crypto').randomUUID();
|
||||
const ref = getSUID();
|
||||
this.client.log.warn.tickets('An error occurred whilst creating ticket', channel.id);
|
||||
this.client.log.error.tickets(ref);
|
||||
this.client.log.error.tickets(error);
|
||||
|
Reference in New Issue
Block a user