You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can u explain me how can I call the connection of the bot in multiple js files?
I have two routes, telegram.js and ask.js that uses the telebot library
I have a connection to the bot in a file:
const TeleBot = require('telebot');
const telegramConstants = require("../../config/config");
const bot = new TeleBot({
token: telegramConstants.botToken,
polling: { // Optional. Use polling.
interval: 60, // Optional. How often check updates (in ms).
timeout: 0, // Optional. Update polling timeout (0 - short polling).
limit: 100, // Optional. Limits the number of updates to be retrieved.
retryTimeout: 1000, // Optional. Reconnecting timeout (in ms).
allowedUpdates: [] // Optional. List the types of updates you want your bot to receive. Specify an empty list to receive all updates regardless of type.
}
});
bot.connect();
module.exports = bot;
And I call it in my two js files but it creates a new instance for every call.
Its possible to use one instance of the telebot in my two files?
The text was updated successfully, but these errors were encountered:
constTeleBot=require('telebot');constmyBotModule=require('./myBotModule.js');constbot=newTeleBot('***');bot.use(myBotModule);// use our module (exports interface and config)bot.on('/start',msg=>{returnbot.sendMessage(msg.from.id,'Start!');});bot.connect();
Can u explain me how can I call the connection of the bot in multiple js files?
I have two routes, telegram.js and ask.js that uses the telebot library
I have a connection to the bot in a file:
And I call it in my two js files but it creates a new instance for every call.
Its possible to use one instance of the telebot in my two files?
The text was updated successfully, but these errors were encountered: