-
-
Save Kennyl/6deb45827969fbd213c2b62d461a859d to your computer and use it in GitHub Desktop.
How to build Telegram bot with Wit.ai Bot Engine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install telegraf telegraf-wit | |
var Telegraf = require('telegraf') | |
var TelegrafWit = require('telegraf-wit') | |
var app = new Telegraf(process.env.BOT_TOKEN) | |
var wit = new TelegrafWit(process.env.WIT_TOKEN) | |
app.use(Telegraf.memorySession()) | |
app.use(wit.middleware()) | |
wit.onMessage(function * () { | |
yield this.reply(this.state.wit.message) | |
}) | |
app.startPolling() | |
// Other example: https://github.com/telegraf/telegraf-wit/blob/develop/examples/wit-bot.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment