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
getMainBot
Usage:
const mainBot = multiBotInstance.getMainBot();
Returns:
{TelegramBot|undefined}
: Returns the main bot instance if it exists, orundefined
if 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
type
is "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
undefined
if no bot is designated as the main bot in the current setup.
Last updated