getMainBot
The getMainBot method retrieves the main bot instance from the current configuration. This method is designed to work only for configurations of type "one".
Method getMainBot
getMainBotUsage:
const mainBot = multiBotInstance.getMainBot();Returns:
{TelegramBot|undefined}: Returns the main bot instance if it exists, orundefinedif no main bot is set.
Example:
const mainBot = multiBotInstance.getMainBot();
if (mainBot) {
mainBot.sendMessage(chatId, 'Hello from the main bot!');
} else {
console.log('No main bot found.');
}Notes:
This method is only available for configurations where
typeis "one". If the type is "multi", this method will not function as intended.Ensure that the main bot is properly initialized and set in the configuration.
The method returns
undefinedif no bot is designated as the main bot in the current setup.
Last updated