The bot does not see the command in the discord chat
Good afternoon, I created a bot for the discord chat, uploaded it to the server. According to the idea, the bot should be after the command !ft (speed+distance) output a message about the time spent. But when I write this command in any channel, nothing happens. Where to dig?
const bot = new Discord.Client();
//подключаем файл конфигурации
let config = require('./botconfig.json');
//"достаём" токен и префикс
let token = config.token;
let prefix = config.prefix;
//создаём ссылку-приглашение для бота
bot.on('ready', () => {
console.log(`Запустился бот ${bot.user.username}`);
bot.generateInvite(["ADMINISTRATOR"]).then(link => {
console.log(link);
});
});
//команда, и то, что она должна выполнить
bot.on('message', msg => {
if(message.content.startsWith("!ft")){
let args = message.content.split(" ").slice(1)
let x = args[0].split("+")[0]
let y = args[0].split("+")[1]
let time = require('ms-advanced')(Math.floor(x/y)*60000)
message.channel.send(`Время полёта составит ${time.replace("h","ч").replace(/[0-9]+ms/g,"").replace("s","сек").replace("m","мин")}
${Math.floor(y/200)} SU, где: 1 SU = 200 км
`)
}
});
bot.login(token);```
[![https://i.stack.imgur.com/XYDm3.png][1]][1]
[1]: https://i.stack.imgur.com/7nMZy.png
0