mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-04 01:11:27 +03:00
fix: send()
user create button if possible
to avoid the "Original message was deleted" text
This commit is contained in:
@@ -35,7 +35,7 @@ module.exports = class CreateUserCommand extends UserCommand {
|
|||||||
await interaction.deferReply({ flags: 'Ephemeral' });
|
await interaction.deferReply({ flags: 'Ephemeral' });
|
||||||
|
|
||||||
const settings = await client.prisma.guild.findUnique({
|
const settings = await client.prisma.guild.findUnique({
|
||||||
include: { categories:true },
|
include: { categories: true },
|
||||||
where: { id: interaction.guild.id },
|
where: { id: interaction.guild.id },
|
||||||
});
|
});
|
||||||
const getMessage = client.i18n.getLocale(settings.locale);
|
const getMessage = client.i18n.getLocale(settings.locale);
|
||||||
@@ -55,7 +55,7 @@ module.exports = class CreateUserCommand extends UserCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const prompt = async categoryId => {
|
const prompt = async categoryId => {
|
||||||
interaction.followUp({
|
const payload = {
|
||||||
components: [
|
components: [
|
||||||
new ActionRowBuilder()
|
new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
@@ -81,7 +81,12 @@ module.exports = class CreateUserCommand extends UserCommand {
|
|||||||
.setTitle(getMessage('commands.user.create.prompt.title'))
|
.setTitle(getMessage('commands.user.create.prompt.title'))
|
||||||
.setDescription(getMessage('commands.user.create.prompt.description')),
|
.setDescription(getMessage('commands.user.create.prompt.description')),
|
||||||
],
|
],
|
||||||
});
|
};
|
||||||
|
try {
|
||||||
|
await interaction.channel.send(payload);
|
||||||
|
} catch {
|
||||||
|
await interaction.followUp(payload);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (settings.categories.length === 0) {
|
if (settings.categories.length === 0) {
|
||||||
@@ -96,8 +101,6 @@ module.exports = class CreateUserCommand extends UserCommand {
|
|||||||
});
|
});
|
||||||
} else if (settings.categories.length === 1) {
|
} else if (settings.categories.length === 1) {
|
||||||
const category = settings.categories[0];
|
const category = settings.categories[0];
|
||||||
// ! must be awaited,
|
|
||||||
// ! followUp will act as editReply (on the original ephemeral message) if it arrives first
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
components: [],
|
components: [],
|
||||||
embeds: [
|
embeds: [
|
||||||
@@ -146,8 +149,6 @@ module.exports = class CreateUserCommand extends UserCommand {
|
|||||||
})
|
})
|
||||||
.then(async i => {
|
.then(async i => {
|
||||||
const category = settings.categories.find(c => c.id === Number(i.values[0]));
|
const category = settings.categories.find(c => c.id === Number(i.values[0]));
|
||||||
// ! must be awaited,
|
|
||||||
// ! followUp will act as editReply (on the original ephemeral message) if it arrives first
|
|
||||||
await i.update({
|
await i.update({
|
||||||
components: [],
|
components: [],
|
||||||
embeds: [
|
embeds: [
|
||||||
@@ -167,7 +168,7 @@ module.exports = class CreateUserCommand extends UserCommand {
|
|||||||
})
|
})
|
||||||
.catch(async error => {
|
.catch(async error => {
|
||||||
client.log.error(error);
|
client.log.error(error);
|
||||||
await interaction.reply({
|
await interaction.editReply({
|
||||||
components: [],
|
components: [],
|
||||||
embeds: [
|
embeds: [
|
||||||
new ExtendedEmbedBuilder({
|
new ExtendedEmbedBuilder({
|
||||||
|
Reference in New Issue
Block a user