Skip to content

Commit

Permalink
chore: improve error for 404 getMe
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Sep 1, 2024
1 parent 641499b commit e3ded98
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,17 @@ export class Bot<
this.lazyloadPlugins.map(async (plugin) => this.extend(await plugin)),
);

this.info = await this.api.getMe();
const info = await this.api.getMe({
suppress: true,
});

if (info instanceof TelegramError) {
if (info.code === 404)
info.message = "The bot token is incorrect. Check it in BotFather.";
throw info;
}

this.info = info;
}

/**
Expand Down

0 comments on commit e3ded98

Please sign in to comment.