Keith/app.js

26 lines
634 B
JavaScript
Raw Normal View History

2020-06-21 12:01:11 +01:00
const TelegramBot = require('node-telegram-bot-api');
const token = '1012409404:AAE-Vt0W_Cfp6ENnz1aZgPaBW_7_kBD7CJI';
const bot = new TelegramBot(token, { polling: true });
bot.on('message', (msg) => {
var hi = "hi";
if (msg.text.toString().toLowerCase().indexOf(hi) === 0) {
bot.sendMessage(msg.chat.id, "Hello dear user");
}
var bye = "bye";
if (msg.text.toString().toLowerCase().includes(bye)) {
bot.sendMessage(msg.chat.id, "Hope to see you around again , Bye");
}
}),
bot.onText(/\/start/, (msg) => {
bot.sendMessage(msg.chat.id, "Welcome to BigBoxLittleBox Bot");
})