Answer the question
In order to leave comments, you need to log in
How to quickly clear a channel?
For example, using the !cc command, the channel will be cleared completely. PS I know that the limit is 100 proposals for cleansing.
Answer the question
In order to leave comments, you need to log in
Good day! The answer to this question is on the Internet, learn to google, but still
For convenience, we will create two files: index.js, command.js.
index.js:
const Discord = require('discord.js')
const client = new Discord.Client()
const command = require('./command')
client.on('ready', () => {
console.log('Клиент готов!')
command(client, ['cc', 'clearchannel'], (message) => {
if (message.member.hasPermission(["ADMINISTRATOR"])) {
message.channel.messages.fetch().then((results) => {
message.channel.bulkDelete(results)
})
}
})
})
const { prefix } = require('./config.json')
module.exports = (client, aliases, callback) => {
if (typeof aliases === 'string') {
aliases = [aliases]
}
client.on('message', message => {
const { content } = message;
aliases.forEach(alias => {
const command = `${prefix}${alias}`
if (content.startsWith(`${command} `) || content === command) {
console.log(`Начинает с команды ${command}`)
callback(message)
}
})
})
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question