-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (26 loc) · 785 Bytes
/
index.js
File metadata and controls
30 lines (26 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const Telegraf = require('telegraf')
const {
Extra,
Markup,
Stage,
session
} = Telegraf
const config = require('config')
const bot = new Telegraf(config.get('token'))
const SceneGenerator = require('./Scenes')
const curScene = new SceneGenerator()
const ageScene = curScene.GenAgeScene()
const nameScene = curScene.GenNameScene()
bot.use(Telegraf.log())
const stage = new Stage([ageScene, nameScene])
bot.use(session())
bot.use(stage.middleware())
bot.start((ctx) => ctx.reply('Welcome'))
bot.help((ctx) => ctx.reply('Send me a sticker'))
bot.command('echo', (ctx) => ctx.reply('Echo'))
bot.command('scenes', async (ctx) => {
ctx.scene.enter('age')
})
bot.on('sticker', (ctx) => ctx.reply('👍'))
bot.hears('hi', (ctx) => ctx.reply('Hey there'))
bot.launch()