mirror of
https://github.com/Art-Portal/April.git
synced 2024-12-26 11:24:16 +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'),
|
||||
async execute(interaction, client) {
|
||||
const number = interaction.options.getInteger('nombre');
|
||||
await interaction.channel.bulkDelete(number);
|
||||
await interaction.reply({ content: `J'ai bien supprimé ${number} message${number>1 ? "s" : ""} dans ce salon`, ephemeral: true});
|
||||
const number = interaction.options.getInteger('nombre');
|
||||
try {
|
||||
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…
Reference in New Issue
Block a user