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
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -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