repl.it
@functorflow/

ccg-bot

Nodejs

No description

fork
loading
Files
  • index.js
  • locales
  • Packager files
  • package-lock.json
  • package.json
index.js
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
31
32
33
34
35
36
37
38
39
const Telegraf = require('telegraf')
const TelegrafI18n = require('telegraf-i18n')
const path = require('path')
const { Extra } = Telegraf

__dirname = path.resolve();

// i18n options
const i18n = new TelegrafI18n({
  directory: path.resolve(__dirname, 'locales'),
  defaultLanguage: 'ru',
  sessionName: 'session',
  useSession: true,
  templateData: {
    pluralize: TelegrafI18n.pluralize,
    uppercase: (value) => value.toUpperCase()
  }
})

// 

const bot = new Telegraf(process.env.BOT_TOKEN)
bot.use(Telegraf.session())
bot.use(i18n.middleware())

// Start message handler
bot.start(({ i18n, replyWithHTML }) => replyWithHTML(i18n.t('greeting')))

bot.command('survey', ({ session, i18n, replyWithChatAction }) => {

  return replyWithChatAction("find_location")

})


bot.startPolling()


Fetching token
?