fix message flags for ephemeral
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
const { SlashCommandBuilder } = require('discord.js');
|
const { SlashCommandBuilder, MessageFlags } = require('discord.js');
|
||||||
const torn = require('../../torn.js');
|
const torn = require('../../torn.js');
|
||||||
const config = require('../../config.json');
|
const config = require('../../config.json');
|
||||||
const state = require('../../state.json');
|
const state = require('../../state.json');
|
||||||
@@ -16,17 +16,17 @@ module.exports = {
|
|||||||
const task = interaction.client.tasks[taskName];
|
const task = interaction.client.tasks[taskName];
|
||||||
|
|
||||||
if (!task) {
|
if (!task) {
|
||||||
await interaction.reply({ content: `Task "${taskName}" not found.`, ephemeral: true });
|
await interaction.reply({ content: `Task "${taskName}" not found.`, flags: MessageFlags.Ephemeral });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await interaction.reply({ content: `Executing task "${taskName}"...`, ephemeral: true });
|
await interaction.reply({ content: `Executing task "${taskName}"...`, flags: MessageFlags.Ephemeral });
|
||||||
await task(interaction.client, torn, config, state);
|
await task(interaction.client, torn, config, state);
|
||||||
await interaction.followUp({ content: `Task "${taskName}" executed successfully.`, ephemeral: true });
|
await interaction.followUp({ content: `Task "${taskName}" executed successfully.`, flags: MessageFlags.Ephemeral });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
await interaction.followUp({ content: `There was an error while executing task "${taskName}"!`, ephemeral: true });
|
await interaction.followUp({ content: `There was an error while executing task "${taskName}"!`, flags: MessageFlags.Ephemeral });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder, MessageFlags } = require('discord.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -8,7 +8,7 @@ module.exports = {
|
|||||||
const taskNames = Object.keys(interaction.client.tasks);
|
const taskNames = Object.keys(interaction.client.tasks);
|
||||||
|
|
||||||
if (taskNames.length === 0) {
|
if (taskNames.length === 0) {
|
||||||
await interaction.reply({ content: 'No tasks found.', ephemeral: true });
|
await interaction.reply({ content: 'No tasks found.', flags: MessageFlags.Ephemeral });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,6 +17,6 @@ module.exports = {
|
|||||||
.setTitle('Available Tasks')
|
.setTitle('Available Tasks')
|
||||||
.setDescription(taskNames.map(name => `- ${name}`).join('\n'));
|
.setDescription(taskNames.map(name => `- ${name}`).join('\n'));
|
||||||
|
|
||||||
await interaction.reply({ embeds: [embed], ephemeral: true });
|
await interaction.reply({ embeds: [embed], flags: MessageFlags.Ephemeral });
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user