Added purge command to admin.

This commit is contained in:
Keanu Timmermans 2020-08-13 17:06:10 +02:00
parent 9d0caaf976
commit facaf001ad
No known key found for this signature in database
GPG key ID: A02B486C183D2147

View file

@ -87,6 +87,24 @@ export default new Command({
}
}
})
}),
purge: new Command({
description: "Purges bot messages.",
permission: Command.PERMISSIONS.BOT_SUPPORT,
async run($: CommonLibrary): Promise<any>
{
$.message.delete();
const msgs = await $.channel.messages.fetch({
limit: 100
});
const travMessages = msgs.filter(m => m.author.id === $.client.user?.id);
await $.message.channel.send(`Found ${travMessages.size} messages to delete.`)
.then(m => m.delete({
timeout: 5000
}));
await $.message.channel.bulkDelete(travMessages);
}
})
}
});