mirror of
https://github.com/Art-Portal/April.git
synced 2025-01-13 15:03:40 +01:00
/clear no longer deletes pinned messages
This commit is contained in:
parent
eb778dce2d
commit
1348db4eb3
@ -15,8 +15,15 @@ module.exports = {
|
|||||||
)
|
)
|
||||||
.setDescription('Supprimer un grand nombre de messages d\'un salon'),
|
.setDescription('Supprimer un grand nombre de messages d\'un salon'),
|
||||||
async execute(interaction, client) {
|
async execute(interaction, client) {
|
||||||
const number = interaction.options.getInteger('nombre');
|
const number = interaction.options.getInteger('nombre');
|
||||||
await interaction.channel.bulkDelete(number);
|
try {
|
||||||
await interaction.reply({ content: `J'ai bien supprimé ${number} message${number>1 ? "s" : ""} dans ce salon`, ephemeral: true});
|
const fetched = await interaction.channel.fetchMessages({ 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});
|
||||||
|
} catch(err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user