Skip to content

Instantly share code, notes, and snippets.

@dotcypress
Last active February 2, 2022 07:14
Show Gist options
  • Save dotcypress/644511bc52a0f5cc6f899cc6bde63cae to your computer and use it in GitHub Desktop.
Save dotcypress/644511bc52a0f5cc6f899cc6bde63cae to your computer and use it in GitHub Desktop.
How to build Telegram bot with Wit.ai Bot Engine
// 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
Copy link

ghost commented May 25, 2017

Where can we deploy these bots? Is it more than enough if we just deploy this code once we make our not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment