Closed OmegaM1 closed 2 years ago
Add const before "bot"
// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {polling: true});
@Drakoniwe Thank you, the pervious problem has been solved But I am receiving a new error which the logs telling that my bot token is not defined
> heroku-node-telegram-bot@1.0.3 start
> node index.js
node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated.
In the future, you will have to enable it yourself.
See https://github.com/yagop/node-telegram-bot-api/issues/319. node:internal/modules/cjs/loader:1105:14
Bot server started in the production mode
/app/web.js:20
app.post('/' + bot.token, (req, res) => {
^
TypeError: Cannot read properties of undefined (reading 'token')
at module.exports (/app/web.js:20:22)
at Object.<anonymous> (/app/index.js:2:17)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Process exited
I have already defined my Heroku URL with the bot token so what's the problem
I found the problem which it was my code I edited "bot.token" to "token" (String variable) and it worked.
Hi, I have setup my bot on Heroku by using heroku-node-telegram-bot code examples but I am getting below error
Is there a way to fix it?