При подключении API Telegram к node.js

220
04 мая 2018, 12:12

Помогите пожалуйста!
Установил программу Node.js, потом создал папку, установил в нее сервер nvm (команда npm init), далее туда же установил библиотеку для взаимодействия с API Telegram (команда npm install --save node-telegram-bot-api), далее написал код:

const TelegramBot = require('node-telegram-bot-api');
// replace the value below with the Telegram token you receive from @BotFather
const token = '557333979:AAHSjnUAVLoYXtoh5-DSEf_d64JmcJLTHqk';
// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {polling: true});
// Matches "/echo [whatever]"
bot.onText(/\/echo (.+)/, (msg, match) => {
  // 'msg' is the received Message from Telegram
  // 'match' is the result of executing the regexp above on the text content
  // of the message
  const chatId = msg.chat.id;
  const resp = match[1]; // the captured "whatever"
  // send back the matched "whatever" to the chat
  bot.sendMessage(chatId, resp);
});
// Listen for any kind of message. There are different kinds of
// messages.
bot.on('message', (msg) => {
  const chatId = msg.chat.id;
  // send a message to the chat acknowledging receipt of their message
  bot.sendMessage(chatId, 'Received your message');
});

Потом выводит ошибку, но бот работает:

node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated. In the future, you will have to enable it yourself. See https://github.com/yagop/node-telegram-bot-api/issues/319. module.js:652:30

READ ALSO
Добавления класса

Добавления класса

Всем привет помогитеУ меня есть несколько тегов strong и у них нету классов

205
Как правильно создать анимацию в Animate.css?

Как правильно создать анимацию в Animate.css?

Изучаю Animatecss и хочу понять на наглядном примере, как реализовать следующую задачу:

195
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object

TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object

Не могу понять в чем проблема пытаюсь запустить сборку gulp и выдает эту ошибкуВот ссылка на сборку https://github

421
Аудио-плеер html+js

Аудио-плеер html+js

Каким образом можно сделать свой аудио плеер на js? Мне не очень не нравятся "дефолтные" плееры в браузерахТакже можете указать готовые плееры

237