Skip to content

onStart

This hook is called when the bot starts.

Parameters

ts
{
		plugins: string[];
		info: TelegramUser;
		updatesFrom: "webhook" | "long-polling";
}
  • plugins - list of plugins
  • info - bot account info
  • updatesFrom - webhook/polling

Example

ts
import { Bot } from "gramio";

const bot = new Bot(process.env.BOT_TOKEN as string).onStart(
    ({ plugins, info, updatesFrom }) => {
        console.log(`plugin list - ${plugins.join(", ")}`);
        console.log(`bot username @${info.username}`);
        console.log(`updates from ${updatesFrom}`);
    }
);

bot.start();