mirror of
https://github.com/Art-Portal/April.git
synced 2024-11-16 11:37:37 +01:00
Update clear.js
This commit is contained in:
parent
1348db4eb3
commit
b4797d7487
@ -15,13 +15,14 @@ module.exports = {
|
||||
)
|
||||
.setDescription('Supprimer un grand nombre de messages d\'un salon'),
|
||||
async execute(interaction, client) {
|
||||
await interaction.deferReply({ ephemeral: true })
|
||||
const number = interaction.options.getInteger('nombre');
|
||||
try {
|
||||
const fetched = await interaction.channel.fetchMessages({ limit: number });
|
||||
const fetched = await interaction.channel.messages.fetch({ limit: number });
|
||||
const notPinned = fetched.filter(fetchedMsg => !fetchedMsg.pinned);
|
||||
|
||||
await interaction.channel.bulkDelete(notPinned, true);
|
||||
await interaction.reply({ content: `J'ai bien supprimé ${number} message${number>1 ? "s" : ""} dans ce salon`, ephemeral: true});
|
||||
await interaction.editReply({ content: `J'ai bien supprimé ${number} message${number>1 ? "s" : ""} dans ce salon`, ephemeral: true});
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user