Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
slack-delete-files.js
function deleteFiles(types = 'all') {
let files = [];
function deleteFilesByTypes(types, page = 1) {
TS.api.call('files.list', {
types,
user: boot_data.user_id,
page
}, (a, data) => {
files = [...files, ...data.files];
if (data.paging.page !== Math.ceil(data.paging.total / data.paging.count)) {
deleteFilesByTypes(types, data.paging.page + 1);
} else {
files.forEach(file =>
TS.api.call('files.delete', {
file: file.id
}, () =>
console.log('Файл удалён: ' + file.name)
)
);
}
});
};
deleteFilesByTypes(types);
};
deleteFiles();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.