Compare commits
No commits in common. "974d01a08f39895b723fd08e30786b95ce3e23ec" and "04fad613b6826ed52ebe23ffe54fe152f014ca66" have entirely different histories.
974d01a08f
...
04fad613b6
21
index.js
21
index.js
@ -20,27 +20,6 @@ const client = new Client({
|
|||||||
|
|
||||||
client.on("ready", () => {
|
client.on("ready", () => {
|
||||||
console.log(`Logged in as ${client.user.tag}!`);
|
console.log(`Logged in as ${client.user.tag}!`);
|
||||||
console.log(`Deleting old messages from this bot in command channel: ${COMMAND_CHANNEL_ID}...`);
|
|
||||||
let channel = client.channels.cache.get(COMMAND_CHANNEL_ID);
|
|
||||||
if (!channel) return console.error("(ready) Can't find command channel");
|
|
||||||
channel.messages.fetch({ limit: 100 }).then(messages => {
|
|
||||||
messages.forEach(message => {
|
|
||||||
if (message.author.id === client.user.id) {
|
|
||||||
message.delete();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).catch(console.error);
|
|
||||||
});
|
|
||||||
|
|
||||||
// send message on error
|
|
||||||
client.on("error", (error) => {
|
|
||||||
console.error(error);
|
|
||||||
let channel = client.channels.cache.get(COMMAND_CHANNEL_ID);
|
|
||||||
if (!channel) return console.error("Can't find command channel");
|
|
||||||
client.channels.cache
|
|
||||||
.get(COMMAND_CHANNEL_ID)
|
|
||||||
.send(`error: ${error.message}`)
|
|
||||||
.catch(console.error);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on("interactionCreate", async (interaction) => {
|
client.on("interactionCreate", async (interaction) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user