Skip to content

onStart

This hook called when the bot is started.

Parameters

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

Example

ts
import { 
Bot
} from "gramio";
const
bot
= new
Bot
(
process
.
env
.
TOKEN
!).
onStart
(
({
plugins
,
info
,
updatesFrom
}) => {
console
.
log
(`plugin list - ${
plugins
.
join
(", ")}`);
console
.
log
(`bot username is @${
info
.
username
}`);
console
.
log
(`updates from ${
updatesFrom
}`);
} );
bot
.
start
();