mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-05 12:23:09 +02:00
Respond with error messages
instead of giving the user no information.
This commit is contained in:
parent
76ed77fe0c
commit
b61b3dd2b1
@ -68,9 +68,6 @@ commands:
|
||||
reason:
|
||||
description: The reason for closing the ticket(s)
|
||||
name: reason
|
||||
ticket:
|
||||
description: The ticket to close
|
||||
name: ticket
|
||||
force-close:
|
||||
confirm_multiple:
|
||||
description: >
|
||||
@ -120,7 +117,7 @@ commands:
|
||||
settings: Bot settings
|
||||
title: Help
|
||||
move:
|
||||
description: move a ticket to another category
|
||||
description: Move a ticket to another category
|
||||
name: move
|
||||
options:
|
||||
category:
|
||||
@ -220,7 +217,8 @@ commands:
|
||||
member:
|
||||
description: The member to transfer ownership to
|
||||
name: member
|
||||
transferred: 📨 {user} has transferred this ticket from {from} to {to}.
|
||||
transferred: 📨 {user} has transferred this ticket to {to}.
|
||||
transferred_from: 📨 {user} has transferred this ticket from {from} to {to}.
|
||||
user:
|
||||
create:
|
||||
name: Create a ticket for user
|
||||
@ -289,8 +287,9 @@ misc:
|
||||
error:
|
||||
description: Sorry, an unexpected error occurred.
|
||||
fields:
|
||||
code: Error code
|
||||
identifier: Identifier
|
||||
title: ⚠️ Something's wrong
|
||||
title: ⚠️ Something went wrong
|
||||
expired:
|
||||
description: You didn't respond in time. Please try again.
|
||||
title: ⏰ Expired
|
||||
@ -334,7 +333,6 @@ ticket:
|
||||
answers:
|
||||
no_value: "*No response*"
|
||||
claimed: 🙌 {user} has claimed this ticket.
|
||||
released: ♻️ {user} has released this ticket.
|
||||
created:
|
||||
description: "Your ticket channel has been created: {channel}."
|
||||
title: ✅ Ticket created
|
||||
@ -357,3 +355,4 @@ ticket:
|
||||
number: Number
|
||||
topic: Topic
|
||||
title: ℹ️ Reference
|
||||
released: ♻️ {user} has released this ticket.
|
||||
|
57
src/listeners/buttons/error.js
Normal file
57
src/listeners/buttons/error.js
Normal file
@ -0,0 +1,57 @@
|
||||
const { Listener } = require('@eartharoid/dbf');
|
||||
const {
|
||||
EmbedBuilder,
|
||||
inlineCode,
|
||||
} = require('discord.js');
|
||||
|
||||
module.exports = class extends Listener {
|
||||
constructor(client, options) {
|
||||
super(client, {
|
||||
...options,
|
||||
emitter: client.buttons,
|
||||
event: 'error',
|
||||
});
|
||||
}
|
||||
|
||||
async run({
|
||||
button,
|
||||
error,
|
||||
interaction,
|
||||
}) {
|
||||
const ref = require('crypto').randomUUID();
|
||||
this.client.log.error.buttons(ref);
|
||||
this.client.log.error.buttons(`"${button.name}" button execution error:`, error);
|
||||
let locale = null;
|
||||
if (interaction.guild) {
|
||||
locale = (await this.client.prisma.guild.findUnique({
|
||||
select: { locale: true },
|
||||
where: { id: interaction.guild.id },
|
||||
})).locale;
|
||||
}
|
||||
const getMessage = this.client.i18n.getLocale(locale);
|
||||
const fields = [
|
||||
{
|
||||
name: getMessage('misc.error.fields.identifier'),
|
||||
value: inlineCode(ref),
|
||||
},
|
||||
];
|
||||
if (error.name) {
|
||||
fields.unshift({
|
||||
name: getMessage('misc.error.fields.code'),
|
||||
value: inlineCode(error.name),
|
||||
});
|
||||
}
|
||||
const data = {
|
||||
components: [],
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Orange')
|
||||
.setTitle(getMessage('misc.error.title'))
|
||||
.setDescription(getMessage('misc.error.description'))
|
||||
.addFields(fields),
|
||||
],
|
||||
};
|
||||
|
||||
interaction.reply(data).catch(() => interaction.editReply(data));
|
||||
}
|
||||
};
|
@ -1,4 +1,8 @@
|
||||
const { Listener } = require('@eartharoid/dbf');
|
||||
const {
|
||||
EmbedBuilder,
|
||||
inlineCode,
|
||||
} = require('discord.js');
|
||||
|
||||
module.exports = class extends Listener {
|
||||
constructor(client, options) {
|
||||
@ -9,11 +13,45 @@ module.exports = class extends Listener {
|
||||
});
|
||||
}
|
||||
|
||||
run({
|
||||
async run({
|
||||
command,
|
||||
error,
|
||||
interaction,
|
||||
}) {
|
||||
const ref = require('crypto').randomUUID();
|
||||
this.client.log.error.commands(ref);
|
||||
this.client.log.error.commands(`"${command.name}" command execution error:`, error);
|
||||
return true;
|
||||
let locale = null;
|
||||
if (interaction.guild) {
|
||||
locale = (await this.client.prisma.guild.findUnique({
|
||||
select: { locale: true },
|
||||
where: { id: interaction.guild.id },
|
||||
})).locale;
|
||||
}
|
||||
const getMessage = this.client.i18n.getLocale(locale);
|
||||
const fields = [
|
||||
{
|
||||
name: getMessage('misc.error.fields.identifier'),
|
||||
value: inlineCode(ref),
|
||||
},
|
||||
];
|
||||
if (error.name) {
|
||||
fields.unshift({
|
||||
name: getMessage('misc.error.fields.code'),
|
||||
value: inlineCode(error.name),
|
||||
});
|
||||
}
|
||||
const data = {
|
||||
components: [],
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('Orange')
|
||||
.setTitle(getMessage('misc.error.title'))
|
||||
.setDescription(getMessage('misc.error.description'))
|
||||
.addFields(fields),
|
||||
],
|
||||
};
|
||||
|
||||
interaction.reply(data).catch(() => interaction.editReply(data));
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user