Answer the question
In order to leave comments, you need to log in
I create my own bot for tg, but even the example from the github repository does not work?
I don't understand what I'm doing wrong.
I do it according to the article from Habr , created a bot in tg, got a token, copied the code from the telegraph repository, created index.js, initialized npm, added the telegraph itself to the folder, inserted my token, called it in the console node index.js
and got this:
const bot = new Telegraf(process.env.ЗДЕСЬ_БЫЛ_МОЙ_ТОКЕН)
^^^
SyntaxError: missing ) after argument list
at Module._compile (internal/modules/cjs/loader.js:718:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
at internal/main/run_main_module.js:17:11
const Telegraf = require('telegraf')
const bot = new Telegraf(process.env.BOT_TOKEN)
bot.start((ctx) => ctx.reply('Welcome!'))
bot.help((ctx) => ctx.reply('Send me a sticker'))
bot.on('sticker', (ctx) => ctx.reply(''))
bot.hears('hi', (ctx) => ctx.reply('Hey there'))
bot.launch()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question