mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-02-23 18:51:29 +02:00
feat: ephemeral replies on (un)claim buttons (#580)
* new lines * ephemeral button interactions * send message to channel if interaction is ephemeral * move deferreply to use ephemeral on no perms * .editReply() -> .reply()
This commit is contained in:
parent
e53c064bf7
commit
b3a2bb00a1
@ -23,4 +23,4 @@ module.exports = class ReferencesCompleter extends Autocompleter {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -47,4 +47,4 @@ module.exports = class TagCompleter extends Autocompleter {
|
|||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,6 @@ module.exports = class ClaimButton extends Button {
|
|||||||
/** @type {import("client")} */
|
/** @type {import("client")} */
|
||||||
const client = this.client;
|
const client = this.client;
|
||||||
|
|
||||||
await interaction.deferReply({ ephemeral: false });
|
|
||||||
await client.tickets.claim(interaction);
|
await client.tickets.claim(interaction);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,6 @@ module.exports = class UnclaimButton extends Button {
|
|||||||
/** @type {import("client")} */
|
/** @type {import("client")} */
|
||||||
const client = this.client;
|
const client = this.client;
|
||||||
|
|
||||||
await interaction.deferReply({ ephemeral: false });
|
|
||||||
await client.tickets.release(interaction);
|
await client.tickets.release(interaction);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -72,4 +72,4 @@ module.exports = class PinMessageCommand extends MessageCommand {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -141,4 +141,4 @@ module.exports = class AddSlashCommand extends SlashCommand {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -23,4 +23,4 @@ module.exports = class ClaimSlashCommand extends SlashCommand {
|
|||||||
await interaction.deferReply({ ephemeral: false });
|
await interaction.deferReply({ ephemeral: false });
|
||||||
await client.tickets.claim(interaction);
|
await client.tickets.claim(interaction);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -34,4 +34,4 @@ module.exports = class CloseSlashCommand extends SlashCommand {
|
|||||||
const client = this.client;
|
const client = this.client;
|
||||||
await client.tickets.beforeRequestClose(interaction);
|
await client.tickets.beforeRequestClose(interaction);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -76,4 +76,4 @@ module.exports = class ClaimSlashCommand extends SlashCommand {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -35,4 +35,4 @@ module.exports = class NewSlashCommand extends SlashCommand {
|
|||||||
async run(interaction) {
|
async run(interaction) {
|
||||||
await useGuild(this.client, interaction, { referencesTicketId: interaction.options.getString('references', false) });
|
await useGuild(this.client, interaction, { referencesTicketId: interaction.options.getString('references', false) });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -23,4 +23,4 @@ module.exports = class ReleaseSlashCommand extends SlashCommand {
|
|||||||
await interaction.deferReply({ ephemeral: false });
|
await interaction.deferReply({ ephemeral: false });
|
||||||
await client.tickets.release(interaction);
|
await client.tickets.release(interaction);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -140,4 +140,4 @@ module.exports = class RemoveSlashCommand extends SlashCommand {
|
|||||||
userId: interaction.user.id,
|
userId: interaction.user.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -57,4 +57,4 @@ module.exports = class TagSlashCommand extends SlashCommand {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -81,4 +81,4 @@ module.exports = class TopicSlashCommand extends SlashCommand {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -778,7 +778,7 @@ module.exports = class TicketManager {
|
|||||||
const getMessage = this.client.i18n.getLocale(ticket.guild.locale);
|
const getMessage = this.client.i18n.getLocale(ticket.guild.locale);
|
||||||
|
|
||||||
if (!(await isStaff(interaction.guild, interaction.user.id))) { // if user is not staff
|
if (!(await isStaff(interaction.guild, interaction.user.id))) { // if user is not staff
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new ExtendedEmbedBuilder({
|
new ExtendedEmbedBuilder({
|
||||||
iconURL: interaction.guild.iconURL(),
|
iconURL: interaction.guild.iconURL(),
|
||||||
@ -788,9 +788,12 @@ module.exports = class TicketManager {
|
|||||||
.setTitle(getMessage('commands.slash.claim.not_staff.title'))
|
.setTitle(getMessage('commands.slash.claim.not_staff.title'))
|
||||||
.setDescription(getMessage('commands.slash.claim.not_staff.description')),
|
.setDescription(getMessage('commands.slash.claim.not_staff.description')),
|
||||||
],
|
],
|
||||||
|
ephemeral: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await interaction.deferReply({ ephemeral: false });
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
interaction.channel.permissionOverwrites.edit(interaction.user, { 'ViewChannel': true }, `Ticket claimed by ${interaction.user.tag}`),
|
interaction.channel.permissionOverwrites.edit(interaction.user, { 'ViewChannel': true }, `Ticket claimed by ${interaction.user.tag}`),
|
||||||
...ticket.category.staffRoles.map(role => interaction.channel.permissionOverwrites.edit(role, { 'ViewChannel': false }, `Ticket claimed by ${interaction.user.tag}`)),
|
...ticket.category.staffRoles.map(role => interaction.channel.permissionOverwrites.edit(role, { 'ViewChannel': false }, `Ticket claimed by ${interaction.user.tag}`)),
|
||||||
@ -878,7 +881,7 @@ module.exports = class TicketManager {
|
|||||||
const getMessage = this.client.i18n.getLocale(ticket.guild.locale);
|
const getMessage = this.client.i18n.getLocale(ticket.guild.locale);
|
||||||
|
|
||||||
if (!(await isStaff(interaction.guild, interaction.user.id))) { // if user is not staff
|
if (!(await isStaff(interaction.guild, interaction.user.id))) { // if user is not staff
|
||||||
return await interaction.editReply({
|
return await interaction.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new ExtendedEmbedBuilder({
|
new ExtendedEmbedBuilder({
|
||||||
iconURL: interaction.guild.iconURL(),
|
iconURL: interaction.guild.iconURL(),
|
||||||
@ -888,9 +891,12 @@ module.exports = class TicketManager {
|
|||||||
.setTitle(getMessage('commands.slash.claim.not_staff.title'))
|
.setTitle(getMessage('commands.slash.claim.not_staff.title'))
|
||||||
.setDescription(getMessage('commands.slash.claim.not_staff.description')),
|
.setDescription(getMessage('commands.slash.claim.not_staff.description')),
|
||||||
],
|
],
|
||||||
|
ephemeral: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await interaction.deferReply({ ephemeral: false });
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
interaction.channel.permissionOverwrites.delete(interaction.user, `Ticket released by ${interaction.user.tag}`),
|
interaction.channel.permissionOverwrites.delete(interaction.user, `Ticket released by ${interaction.user.tag}`),
|
||||||
...ticket.category.staffRoles.map(role => interaction.channel.permissionOverwrites.edit(role, { 'ViewChannel': true }, `Ticket released by ${interaction.user.tag}`)),
|
...ticket.category.staffRoles.map(role => interaction.channel.permissionOverwrites.edit(role, { 'ViewChannel': true }, `Ticket released by ${interaction.user.tag}`)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user