fix: #250 by deferring then editing the reply

This commit is contained in:
Isaac 2021-10-26 16:58:06 +01:00
parent 9bfee81157
commit d3ed6405db
No known key found for this signature in database
GPG Key ID: 87B9B6BD04EB7534
14 changed files with 61 additions and 59 deletions

View File

@ -41,7 +41,7 @@ module.exports = class AddCommand extends Command {
const t_row = await this.client.tickets.resolve(channel.id, interaction.guild.id); const t_row = await this.client.tickets.resolve(channel.id, interaction.guild.id);
if (!t_row) { if (!t_row) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -56,7 +56,7 @@ module.exports = class AddCommand extends Command {
const member = interaction.options.getMember(default_i18n('commands.add.options.member.name')); const member = interaction.options.getMember(default_i18n('commands.add.options.member.name'));
if (!member) { if (!member) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -69,7 +69,7 @@ module.exports = class AddCommand extends Command {
} }
if (t_row.creator !== interaction.member.id && !await this.client.utils.isStaff(interaction.member)) { if (t_row.creator !== interaction.member.id && !await this.client.utils.isStaff(interaction.member)) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -81,7 +81,7 @@ module.exports = class AddCommand extends Command {
}); });
} }
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)

View File

@ -65,7 +65,7 @@ module.exports = class BlacklistCommand extends Command {
const type = member_or_role instanceof Role ? 'role' : 'member'; const type = member_or_role instanceof Role ? 'role' : 'member';
if (type === 'member' && await this.client.utils.isStaff(member_or_role)) { if (type === 'member' && await this.client.utils.isStaff(member_or_role)) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -78,7 +78,7 @@ module.exports = class BlacklistCommand extends Command {
} }
blacklist[type + 's'].push(member_or_role.id); blacklist[type + 's'].push(member_or_role.id);
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)
@ -97,7 +97,7 @@ module.exports = class BlacklistCommand extends Command {
const index = blacklist[type + 's'].findIndex(element => element === member_or_role.id); const index = blacklist[type + 's'].findIndex(element => element === member_or_role.id);
if (index === -1) { if (index === -1) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -110,7 +110,7 @@ module.exports = class BlacklistCommand extends Command {
} }
blacklist[type + 's'].splice(index, 1); blacklist[type + 's'].splice(index, 1);
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)
@ -125,7 +125,7 @@ module.exports = class BlacklistCommand extends Command {
} }
case default_i18n('commands.blacklist.options.show.name'): { case default_i18n('commands.blacklist.options.show.name'): {
if (blacklist.members.length === 0 && blacklist.roles.length === 0) { if (blacklist.members.length === 0 && blacklist.roles.length === 0) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)
@ -138,7 +138,7 @@ module.exports = class BlacklistCommand extends Command {
} else { } else {
const members = blacklist.members.map(id => `**·** <@${id}>`); const members = blacklist.members.map(id => `**·** <@${id}>`);
const roles = blacklist.roles.map(id => `**·** <@&${id}>`); const roles = blacklist.roles.map(id => `**·** <@&${id}>`);
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)

View File

@ -53,7 +53,7 @@ module.exports = class CloseCommand extends Command {
if (time) { if (time) {
if (!await this.client.utils.isStaff(interaction.member)) { if (!await this.client.utils.isStaff(interaction.member)) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -69,7 +69,7 @@ module.exports = class CloseCommand extends Command {
try { try {
period = ms(time); period = ms(time);
} catch { } catch {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -89,7 +89,7 @@ module.exports = class CloseCommand extends Command {
}); });
if (tickets.count === 0) { if (tickets.count === 0) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -100,7 +100,7 @@ module.exports = class CloseCommand extends Command {
ephemeral: true ephemeral: true
}); });
} else { } else {
await interaction.reply({ await interaction.editReply({
components: [ components: [
new MessageActionRow() new MessageActionRow()
.addComponents( .addComponents(
@ -193,7 +193,7 @@ module.exports = class CloseCommand extends Command {
if (ticket) { if (ticket) {
t_row = await this.client.tickets.resolve(ticket, interaction.guild.id); t_row = await this.client.tickets.resolve(ticket, interaction.guild.id);
if (!t_row) { if (!t_row) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -207,7 +207,7 @@ module.exports = class CloseCommand extends Command {
} else { } else {
t_row = await this.client.db.models.Ticket.findOne({ where: { id: interaction.channel.id } }); t_row = await this.client.db.models.Ticket.findOne({ where: { id: interaction.channel.id } });
if (!t_row) { if (!t_row) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -221,7 +221,7 @@ module.exports = class CloseCommand extends Command {
} }
if (t_row.creator !== interaction.member.id && !await this.client.utils.isStaff(interaction.member)) { if (t_row.creator !== interaction.member.id && !await this.client.utils.isStaff(interaction.member)) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -233,7 +233,7 @@ module.exports = class CloseCommand extends Command {
}); });
} }
await interaction.reply({ await interaction.editReply({
components: [ components: [
new MessageActionRow() new MessageActionRow()
.addComponents( .addComponents(

View File

@ -34,7 +34,7 @@ module.exports = class HelpCommand extends Command {
: command.description; : command.description;
return `**\`/${command.name}\` ·** ${description}`; return `**\`/${command.name}\` ·** ${description}`;
}); });
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)

View File

@ -58,7 +58,7 @@ module.exports = class NewCommand extends Command {
], ],
ephemeral: true ephemeral: true
}; };
await i ? i.editReply(response) : interaction.reply(response); await i ? i.editReply(response) : interaction.editReply(response);
} else { } else {
const list = tickets.rows.map(row => { const list = tickets.rows.map(row => {
if (row.topic) { if (row.topic) {
@ -81,7 +81,7 @@ module.exports = class NewCommand extends Command {
], ],
ephemeral: true ephemeral: true
}; };
await i ? i.editReply(response) : interaction.reply(response); await i ? i.editReply(response) : interaction.editReply(response);
} }
} else { } else {
try { try {
@ -98,7 +98,7 @@ module.exports = class NewCommand extends Command {
], ],
ephemeral: true ephemeral: true
}; };
await i ? i.editReply(response) : interaction.reply(response); await i ? i.editReply(response) : interaction.editReply(response);
} catch (error) { } catch (error) {
const response = { const response = {
components: [], components: [],
@ -112,7 +112,7 @@ module.exports = class NewCommand extends Command {
], ],
ephemeral: true ephemeral: true
}; };
await i ? i.editReply(response) : interaction.reply(response); await i ? i.editReply(response) : interaction.editReply(response);
} }
} }
}; };
@ -120,7 +120,7 @@ module.exports = class NewCommand extends Command {
const categories = await this.client.db.models.Category.findAndCountAll({ where: { guild: interaction.guild.id } }); const categories = await this.client.db.models.Category.findAndCountAll({ where: { guild: interaction.guild.id } });
if (categories.count === 0) { if (categories.count === 0) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -133,7 +133,7 @@ module.exports = class NewCommand extends Command {
} else if (categories.count === 1) { } else if (categories.count === 1) {
create(categories.rows[0]); // skip the category selection create(categories.rows[0]); // skip the category selection
} else { } else {
await interaction.reply({ await interaction.editReply({
components: [ components: [
new MessageActionRow() new MessageActionRow()
.addComponents( .addComponents(

View File

@ -75,7 +75,7 @@ module.exports = class PanelCommand extends Command {
const thumbnail = interaction.options.getString(default_i18n('commands.panel.options.thumbnail.name')); const thumbnail = interaction.options.getString(default_i18n('commands.panel.options.thumbnail.name'));
if (just_type && categories.length > 1) { if (just_type && categories.length > 1) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -98,7 +98,7 @@ module.exports = class PanelCommand extends Command {
}); });
if (invalid_category) { if (invalid_category) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -196,7 +196,7 @@ module.exports = class PanelCommand extends Command {
} }
} }
interaction.reply({ interaction.editReply({
content: `${panel_channel}`, content: `${panel_channel}`,
ephemeral: true ephemeral: true
}); });

View File

@ -41,7 +41,7 @@ module.exports = class RemoveCommand extends Command {
const t_row = await this.client.tickets.resolve(channel.id, interaction.guild.id); const t_row = await this.client.tickets.resolve(channel.id, interaction.guild.id);
if (!t_row) { if (!t_row) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -56,7 +56,7 @@ module.exports = class RemoveCommand extends Command {
const member = interaction.options.getMember(default_i18n('commands.remove.options.member.name')); const member = interaction.options.getMember(default_i18n('commands.remove.options.member.name'));
if (!member) { if (!member) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -69,7 +69,7 @@ module.exports = class RemoveCommand extends Command {
} }
if (t_row.creator !== interaction.user.id && !await this.client.utils.isStaff(interaction.member)) { if (t_row.creator !== interaction.user.id && !await this.client.utils.isStaff(interaction.member)) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -81,7 +81,7 @@ module.exports = class RemoveCommand extends Command {
}); });
} }
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)

View File

@ -233,7 +233,7 @@ module.exports = class SettingsCommand extends Command {
roles roles
}); });
await this.client.commands.updatePermissions(interaction.guild); await this.client.commands.updatePermissions(interaction.guild);
interaction.reply({ interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)
@ -249,7 +249,7 @@ module.exports = class SettingsCommand extends Command {
const channel = this.client.channels.cache.get(interaction.options.getString(default_i18n('commands.settings.options.categories.options.delete.options.id.name'))); const channel = this.client.channels.cache.get(interaction.options.getString(default_i18n('commands.settings.options.categories.options.delete.options.id.name')));
if (channel) channel.delete(); if (channel) channel.delete();
await category.destroy(); await category.destroy();
interaction.reply({ interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)
@ -258,7 +258,7 @@ module.exports = class SettingsCommand extends Command {
ephemeral: true ephemeral: true
}); });
} else { } else {
interaction.reply({ interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -272,7 +272,7 @@ module.exports = class SettingsCommand extends Command {
case default_i18n('commands.settings.options.categories.options.edit.name'): { case default_i18n('commands.settings.options.categories.options.edit.name'): {
const category = await this.client.db.models.Category.findOne({ where: { id: interaction.options.getString(default_i18n('commands.settings.options.categories.options.delete.options.id.name')) } }); const category = await this.client.db.models.Category.findOne({ where: { id: interaction.options.getString(default_i18n('commands.settings.options.categories.options.delete.options.id.name')) } });
if (!category) { if (!category) {
return interaction.reply({ return interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -304,7 +304,7 @@ module.exports = class SettingsCommand extends Command {
if (roles !== null) category.set('roles', roles.replace(/\s/g, '').split(',')); if (roles !== null) category.set('roles', roles.replace(/\s/g, '').split(','));
if (survey !== null) category.set('survey', survey); if (survey !== null) category.set('survey', survey);
await category.save(); await category.save();
interaction.reply({ interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)
@ -316,7 +316,7 @@ module.exports = class SettingsCommand extends Command {
} }
case default_i18n('commands.settings.options.categories.options.list.name'): { case default_i18n('commands.settings.options.categories.options.list.name'): {
const categories = await this.client.db.models.Category.findAll({ where: { guild: interaction.guild.id } }); const categories = await this.client.db.models.Category.findAll({ where: { guild: interaction.guild.id } });
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)
@ -343,7 +343,7 @@ module.exports = class SettingsCommand extends Command {
if (log_messages !== null) settings.set('log_messages', log_messages); if (log_messages !== null) settings.set('log_messages', log_messages);
if (success_colour !== null) settings.set('success_colour', success_colour.toUpperCase()); if (success_colour !== null) settings.set('success_colour', success_colour.toUpperCase());
await settings.save(); await settings.save();
interaction.reply({ interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)

View File

@ -90,6 +90,6 @@ module.exports = class StatsCommand extends Command {
embeds.push(global_embed); embeds.push(global_embed);
} }
await interaction.reply({ embeds }); await interaction.editReply({ embeds });
} }
}; };

View File

@ -90,7 +90,7 @@ module.exports = class SurveyCommand extends Command {
`${survey.name}.html` `${survey.name}.html`
); );
return await interaction.reply({ return await interaction.editReply({
ephemeral: true, ephemeral: true,
files: [attachment] files: [attachment]
}); });
@ -98,7 +98,7 @@ module.exports = class SurveyCommand extends Command {
const surveys = await this.client.db.models.Survey.findAll({ where: { guild: interaction.guild.id } }); const surveys = await this.client.db.models.Survey.findAll({ where: { guild: interaction.guild.id } });
const list = surveys.map(s => ` **\`${s.name}\`**`); const list = surveys.map(s => ` **\`${s.name}\`**`);
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)

View File

@ -46,7 +46,7 @@ module.exports = class TagCommand extends Command {
const arg = args.find(arg => arg.name === $1); const arg = args.find(arg => arg.name === $1);
return arg ? arg.value : $; return arg ? arg.value : $;
}); });
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)
@ -56,7 +56,7 @@ module.exports = class TagCommand extends Command {
}); });
} catch { } catch {
const list = Object.keys(settings.tags).map(t => ` **\`${t}\`**`); const list = Object.keys(settings.tags).map(t => ` **\`${t}\`**`);
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)

View File

@ -36,7 +36,7 @@ module.exports = class TopicCommand extends Command {
const t_row = await this.client.db.models.Ticket.findOne({ where: { id: interaction.channel.id } }); const t_row = await this.client.db.models.Ticket.findOne({ where: { id: interaction.channel.id } });
if (!t_row) { if (!t_row) {
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -70,7 +70,7 @@ module.exports = class TopicCommand extends Command {
] ]
}); });
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)

View File

@ -17,13 +17,15 @@ module.exports = class InteractionCreateEventListener extends EventListener {
async execute(interaction) { async execute(interaction) {
this.client.log.debug(interaction); this.client.log.debug(interaction);
await interaction.deferReply();
const settings = await this.client.utils.getSettings(interaction.guild.id); const settings = await this.client.utils.getSettings(interaction.guild.id);
const i18n = this.client.i18n.getLocale(settings.locale); const i18n = this.client.i18n.getLocale(settings.locale);
const blacklisted = settings.blacklist.members.includes[interaction.user.id] || const blacklisted = settings.blacklist.members.includes[interaction.user.id] ||
interaction.member?.roles.cache?.some(role => settings.blacklist.roles.includes(role)); interaction.member?.roles.cache?.some(role => settings.blacklist.roles.includes(role));
if (blacklisted) { if (blacklisted) {
return interaction.reply({ return interaction.editReply({
content: i18n('blacklisted'), content: i18n('blacklisted'),
ephemeral: true ephemeral: true
}); });
@ -34,7 +36,7 @@ module.exports = class InteractionCreateEventListener extends EventListener {
if (!cat_row) { if (!cat_row) {
this.client.log.warn('Could not find a category with the ID given by a panel interaction'); this.client.log.warn('Could not find a category with the ID given by a panel interaction');
return interaction.reply({ return interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -55,7 +57,7 @@ module.exports = class InteractionCreateEventListener extends EventListener {
if (tickets.count >= cat_row.max_per_member) { if (tickets.count >= cat_row.max_per_member) {
if (cat_row.max_per_member === 1) { if (cat_row.max_per_member === 1) {
return interaction.reply({ return interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -76,7 +78,7 @@ module.exports = class InteractionCreateEventListener extends EventListener {
return `<#${row.id}>`; return `<#${row.id}>`;
} }
}); });
return interaction.reply({ return interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -91,7 +93,7 @@ module.exports = class InteractionCreateEventListener extends EventListener {
} else { } else {
try { try {
const t_row = await this.client.tickets.create(interaction.guild.id, interaction.user.id, id); const t_row = await this.client.tickets.create(interaction.guild.id, interaction.user.id, id);
return interaction.reply({ return interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.success_colour) .setColor(settings.success_colour)
@ -104,7 +106,7 @@ module.exports = class InteractionCreateEventListener extends EventListener {
}); });
} catch (error) { } catch (error) {
this.client.log.error(error); this.client.log.error(error);
return interaction.reply({ return interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -141,7 +143,7 @@ module.exports = class InteractionCreateEventListener extends EventListener {
this.client.log.info(`${interaction.user.tag} has claimed "${interaction.channel.name}" in "${interaction.guild.name}"`); this.client.log.info(`${interaction.user.tag} has claimed "${interaction.channel.name}" in "${interaction.guild.name}"`);
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)
@ -191,7 +193,7 @@ module.exports = class InteractionCreateEventListener extends EventListener {
this.client.log.info(`${interaction.user.tag} has released "${interaction.channel.name}" in "${interaction.guild.name}"`); this.client.log.info(`${interaction.user.tag} has released "${interaction.channel.name}" in "${interaction.guild.name}"`);
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.colour) .setColor(settings.colour)
@ -228,7 +230,7 @@ module.exports = class InteractionCreateEventListener extends EventListener {
} else if (interaction.customId.startsWith('ticket.close')) { } else if (interaction.customId.startsWith('ticket.close')) {
// handle ticket close button // handle ticket close button
const t_row = await this.client.db.models.Ticket.findOne({ where: { id: interaction.channel.id } }); const t_row = await this.client.db.models.Ticket.findOne({ where: { id: interaction.channel.id } });
await interaction.reply({ await interaction.editReply({
components: [ components: [
new MessageActionRow() new MessageActionRow()
.addComponents( .addComponents(

View File

@ -165,7 +165,7 @@ module.exports = class CommandManager {
if (!bot_permissions.has(required_bot_permissions)) { if (!bot_permissions.has(required_bot_permissions)) {
const perms = required_bot_permissions.map(p => `\`${p}\``).join(', '); const perms = required_bot_permissions.map(p => `\`${p}\``).join(', ');
if (bot_permissions.has('EMBED_LINKS')) { if (bot_permissions.has('EMBED_LINKS')) {
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor('ORANGE') .setColor('ORANGE')
@ -174,7 +174,7 @@ module.exports = class CommandManager {
] ]
}); });
} else { } else {
await interaction.reply({ content: i18n('bot.missing_permissions.description', perms) }); await interaction.editReply({ content: i18n('bot.missing_permissions.description', perms) });
} }
return; return;
} }
@ -182,7 +182,7 @@ module.exports = class CommandManager {
const missing_permissions = command.permissions instanceof Array && !interaction.member.permissions.has(command.permissions); const missing_permissions = command.permissions instanceof Array && !interaction.member.permissions.has(command.permissions);
if (missing_permissions) { if (missing_permissions) {
const perms = command.permissions.map(p => `\`${p}\``).join(', '); const perms = command.permissions.map(p => `\`${p}\``).join(', ');
return await interaction.reply({ return await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor(settings.error_colour) .setColor(settings.error_colour)
@ -199,7 +199,7 @@ module.exports = class CommandManager {
} catch (e) { } catch (e) {
this.client.log.warn(`An error occurred whilst executing the ${command.name} command`); this.client.log.warn(`An error occurred whilst executing the ${command.name} command`);
this.client.log.error(e); this.client.log.error(e);
await interaction.reply({ await interaction.editReply({
embeds: [ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor('ORANGE') .setColor('ORANGE')