Skip to content

Instantly share code, notes, and snippets.

@dionarya23
Created April 2, 2018 12:27
Show Gist options
  • Save dionarya23/aa326ff1997216a406369ccbd621d6bd to your computer and use it in GitHub Desktop.
Save dionarya23/aa326ff1997216a406369ccbd621d6bd to your computer and use it in GitHub Desktop.
const Telegram = require('node-telegram-bot-api');
const dbot = require('dbot-js')
const token = 'TELEGRAM_TOKEN'
const ksatria_bot = new TelegramBot(token, { polling: true });
ksatria_bot.on('message', function(msg) {
var chatId = msg.chat.id;
var message = msg.text.toString()
dbot.get_response(message, function(err, result){
if (!err) {
ksatria_bot.sendMessage(chatId, result)
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment