In the future, you will have to enable it yourself.
See yagop/node-telegram-bot-api#319. module.js:662:30
This code: process.env["NTBA_FIX_319"] = 1;. don't help me. Help me please!
That code works, put it into very first line of your bot.
@sidelux I did it. But when I put it into top and written in terminal npm run start terminal show me "starting..." and nothing else...
Or maybe I waited very little)
Temporarly Remove All code from your index.js and test with this Code:
process.env.NTBA_FIX_319 = 1;
const TelegramBot = require('node-telegram-bot-api');
// replace the value below with the Telegram token you receive from @BotFather
const token = 'YOUR_TELEGRAM_BOT_TOKEN';
// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {polling: true});
bot.on('message', (msg) => {
const chatId = msg.chat.id;
// send a message to the chat acknowledging receipt of their message
bot.sendMessage(chatId, 'Received your message');
});
@saeedhei Thanks it helped me to remove that message
@mrdimaan Never mind,
@Cyberpunk2027 Can This be Closed?
Interesting, I have [polling error] in terminal, but in Telegram my bot reply me to command /start!
@Cyberpunk2027 in BotFather /revoke and make new token and check again.
process.env.NTBA_FIX_319 = 1
I agree that this solves this problem. But can someone explain what the problem was in the first place and why does this specific line and no other line solves the problem?
@Cyberpunk2027 in BotFather /revoke and make new token and check again.
process.env.NTBA_FIX_319 = 1
I agree that this solves this problem. But can someone explain what the problem was in the first place and why does this specific line and no other line solves the problem?
1) i revoke bot in not father
2) make code on your example.
3) still have this problem on lib version ^0.30.0
@Cyberpunk2027 replace:
bot.on('message', (msg) =>
with
bot.on('message', function (msg) {
bot.on('message', function (msg) {
still have polling_error even after generate new token
so, anybody else have same issue. Just i also change ny token into bot father, nothing help
yes, i have same issue to
still have the issue too
still have the issue too
npm i dotenv.env at the root of your project.NTBA_FIX_319=1index.js file (or whatever file that contains you bot instance): require('dotenv').config()So your code will look like
require('dotenv').config();
const TelegramBot = require('node-telegram-bot-api');
// replace the value below with the Telegram token you receive from @BotFather
const token = 'YOUR_TELEGRAM_BOT_TOKEN';
// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {polling: true});
bot.on('message', (msg) => {
const chatId = msg.chat.id;
// send a message to the chat acknowledging receipt of their message
bot.sendMessage(chatId, 'Received your message');
});
@rotimi-best thx it works now.
What i did before is
const TelegramBot = require('node-telegram-bot-api');
process.env.NTBA_FIX_319 = 1;
const bot = new TelegramBot(token, {polling: true});
but it should be
process.env.NTBA_FIX_319 = 1; // or require('dotenv').config();
// put the code above the import
const TelegramBot = require('node-telegram-bot-api');
const bot = new TelegramBot(token, {polling: true});
For those who still got the issue, you may try.
There is a problem happening after even after adding
process.env.NTBA_FIX_319 = 1;
at the top of the index.js file
This feature has been deprecated? @brunoalfred Any reason why you would want to override it?
so how do I fix it because I am stack.
On Sat, May 2, 2020 at 5:53 PM Mohammed Sohail notifications@github.com
wrote:
This feature has been deprecated? @brunoalfred
https://github.com/brunoalfred Any reason why you would want to
override it?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yagop/node-telegram-bot-api/issues/540#issuecomment-622966054,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ANHY3IUVKFJYI3EJCML3DOLRPQXXZANCNFSM4EUSW62A
.
Hey guys, this line at the beginning of my program works and solve the issue, but can anyone explain please what it does to fix it? Will there be future problems..?
process.env.NTBA_FIX_319 = 1;
still have the issue too
- Install this package
npm i dotenv- Create a file called
.envat the root of your project.- Add to that file this
NTBA_FIX_319=1- Add to the top of your
index.jsfile (or whatever file that contains you bot instance):require('dotenv').config()- Restart your bot.
So your code will look like
require('dotenv').config(); const TelegramBot = require('node-telegram-bot-api'); // replace the value below with the Telegram token you receive from @BotFather const token = 'YOUR_TELEGRAM_BOT_TOKEN'; // Create a bot that uses 'polling' to fetch new updates const bot = new TelegramBot(token, {polling: true}); bot.on('message', (msg) => { const chatId = msg.chat.id; // send a message to the chat acknowledging receipt of their message bot.sendMessage(chatId, 'Received your message'); });work fine tnx
Most helpful comment
Temporarly Remove All code from your index.js and test with this Code: