Всем привет, я делал код для создание каналов
if (message.content.startsWith(prefix + 'chc')) {
const agrc = message.content.slice('15');
message.guild.createChannel ('${agrs}').then(channel => {
channel.setTopic("test")
Когда я прописываю команду chc выдаётся ошибка в консоли:
spoiler(node:13220) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
type: Value "text" is not int.
at C:\Users\dimas\OneDrive\Рабочий стол\Новая папка\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15
at C:\Users\dimas\OneDrive\Рабочий стол\Новая папка\node_modules\snekfetch\src\index.js:215:21
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:13220) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:13220) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Как её решить?
Полный код:
const Discord = require('discord.js');
const bot = new Discord.Client();
const config = require('./config.json');
bot.on('message', async message => {
let prefix = config.prefix;
if (message.content.startsWith(prefix + 'bb')) {
message.channel.send(':japanese_goblin:@everyone:japanese_goblin:')
message.channel.send(':unlock:@everyone:unlock: ')
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
message.channel.send(`:tada: @everyone :tada: `)
}
if (message.content.startsWith(prefix + 'chc')) {
const agrc = message.content.slice('15');
message.guild.createChannel ('${agrs}').then(channel => {
channel.setTopic("test")
})
}
});
bot.login(config.token);
bot.on('ready', () => {
bot.generateInvite(["ADMINISTRATOR"]).then(link =>{
console.log(link);
console.log(`${bot.user.username} online`);
bot.user.setPresence ({status: 'online', game:{name: 'взламываю твой сервер ', type: 2}});
});
})