У меня на сервере запущен Discord-бот. Я хочу, чтобы бот message.react()
получил только что полученное сообщение. Когда я запускаю это, он работает нормально, пока я не отправлю сообщение.
Я получаю эту ошибку:
/Users/*****/Projects/Discord/DiscordBot/bot.js:22
.react("?")
^
TypeError: message.react is not a function
at DiscordClient.bot.on (/Users/revel/Projects/Discord/DiscordBot/bot.js:22:6)
at DiscordClient.emit (events.js:189:13)
at DiscordClient.handleWSMessage (/Users/revel/Projects/Discord/DiscordBot/node_modules/discord.io/lib/index.js:1854:11)
at WebSocket.emit (events.js:189:13)
at Receiver.ontext (/Users/revel/Projects/Discord/DiscordBot/node_modules/ws/lib/WebSocket.js:841:10)
at /Users/revel/Projects/Discord/DiscordBot/node_modules/ws/lib/Receiver.js:536:18
at Receiver.applyExtensions (/Users/revel/Projects/Discord/DiscordBot/node_modules/ws/lib/Receiver.js:371:5)
at /Users/revel/Projects/Discord/DiscordBot/node_modules/ws/lib/Receiver.js:508:14
at Receiver.flush (/Users/revel/Projects/Discord/DiscordBot/node_modules/ws/lib/Receiver.js:347:3)
at Receiver.finish (/Users/revel/Projects/Discord/DiscordBot/node_modules/ws/lib/Receiver.js:541:12)
Вот мой код:
var Discord = require("discord.io");
var logger = require("winston");
var auth = require("./auth.json");
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(new logger.transports.Console(), {
colorize: true,
});
logger.level = "debug";
// Initialize Discord Bot
var bot = new Discord.Client({
token: auth.token,
autorun: true,
});
bot.on("ready", function (evt) {
logger.info("Connected");
logger.info("Logged in as: ");
logger.info(bot.username + " - (" + bot.id + ")");
});
bot.on("message", (message) => {
message.react("?");
});
Я бегу discord.js
версия 12.2.0
Можете помочь?