Closed xydv closed 2 years ago
Hi @icancodebeauty for get better error messages put this line of code:
bot.on('polling_error', (err) => console.log(err));
Shows Error Like This 👇
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:1101:14
{
message_id: 62,
from: {
id: ▒▒▒▒▒▒▒▒▒▒,
is_bot: true,
first_name: 'Group',
username: 'GroupAnonymousBot'
},
sender_chat: {
id: -▒▒▒▒▒▒▒▒▒▒▒▒,
title: 'Yojana Ke Faltu Log',
type: 'supergroup'
},
chat: {
id: -▒▒▒▒▒▒▒▒▒▒▒▒,
title: 'Yojana Ke Faltu Log',
type: 'supergroup'
},
date: 1645503673,
text: '/quote@dedomilbot',
entities: [ { offset: 0, length: 17, type: 'bot_command' } ]
}
ReferenceError: bot is not defined
at handler (/workspace/telegram-bot/handler/handler.js:3:5)
at TelegramBot.<anonymous> (/workspace/telegram-bot/bot.js:7:5)
at TelegramBot.emit (/workspace/telegram-bot/node_modules/eventemitter3/index.js:182:35)
at TelegramBot.processUpdate (/workspace/telegram-bot/node_modules/node-telegram-bot-api/src/telegram.js:635:12)
at /workspace/telegram-bot/node_modules/node-telegram-bot-api/src/telegramPolling.js:110:22
at Array.forEach (<anonymous>)
at /workspace/telegram-bot/node_modules/node-telegram-bot-api/src/telegramPolling.js:106:17
at tryCatcher (/workspace/telegram-bot/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/workspace/telegram-bot/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/workspace/telegram-bot/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/workspace/telegram-bot/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/workspace/telegram-bot/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/workspace/telegram-bot/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/workspace/telegram-bot/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/workspace/telegram-bot/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/workspace/telegram-bot/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (node:internal/timers:464:21)
I am hiding my chat id and user id for privacy!!
Your handler.js
has no the bot instance but used bot.sendMessage
Yes! But How I Add Bot Instance In handler.js?
Its Done Now, I Didn't Send Bot Instance To Handler!!, Thanks To All!!
I Am Getting This Issue, I Tried Many Times!!
bot.js ⬇
handler.js ⬇
Terminal ⬇
Look Into It And Give Suggestions If I Made Mistake!!.