EcoBot/commands/purge.js

27 lines
593 B
JavaScript
Raw Normal View History

2021-11-22 23:37:00 +00:00
const request = require("axios").default;
module.exports = {
api: {
name: "purge",
description: "Purges the first 100 messages in a channel."
},
run: (int, client, index) => {
request(
{
url: "https://discord.com/api/v9/channels/" + int.channel.id + "/messages?limit=100",
headers: {
Authorization: "Bot " + client.token
}
}
).then(res => {
request(
{
url: "https://discord.com/api/v9/channels/" + int.channel.id + "/messages/",
method: "DELETE",
headers: {
Authorization: "Bot " + client.token
}
}
);
});
}
}