Skip to content

Commit

Permalink
Fix interaction never being replied to
Browse files Browse the repository at this point in the history
Mic-R committed Sep 14, 2024
1 parent 44ed014 commit cb87fd9
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions commands/clear_images.js
Original file line number Diff line number Diff line change
@@ -36,16 +36,25 @@ module.exports = {
}

const blobs = containerClient.listBlobsFlat();
console.log(blobs)
let i = 0;
for await (const blob of blobs) {
if(blob.name.startsWith("wichtig/")) return;
console.log(`Blob ${i++}: ${blob.name}`);
await containerClient.deleteBlob(blob.name, {deleteSnapshots: "include"});
}
const i = 0;
try {
for await (const blob of blobs) {
if (!blob.name.startsWith("wichtig/")) { // Do not delete important files
i++;
await containerClient.deleteBlob(blob.name, { deleteSnapshots: "include" });
}
}

return interaction.reply({
content: `Die Gesamtheit von https://${process.env.CDN_URL}/${process.env.CONTAINER_NAME}/ wurde geleert. Grund: ${interaction.options.getString("reason")}`,
});
interaction.reply({
content: `Die Gesamtheit von https://${process.env.CDN_URL}/${process.env.CONTAINER_NAME}/ wurde geleert. ${i} Dateien. Grund: ${interaction.options.getString("reason")}`,
});
}
catch (error) {
console.error(error);
interaction.reply({
content: `Fehler beim Löschen des Speichers: ${error.message}`,
ephemeral: true,
});
}
}
};
}

0 comments on commit cb87fd9

Please sign in to comment.