Skip to content

Commit

Permalink
feat: add bot info property
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Feb 24, 2024
1 parent fcd110a commit 161ae65
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
APIMethodParams,
APIMethods,
TelegramAPIResponse,
TelegramUser,
} from "@gramio/types";
import { FormDataEncoder } from "form-data-encoder";
import { Inspectable } from "inspectable";
Expand All @@ -29,6 +30,7 @@ export class Bot<
Derives extends DeriveDefinitions = DeriveDefinitions,
> {
readonly options: BotOptions = {};
info: TelegramUser | undefined;

readonly api = new Proxy({} as APIMethods, {
get:
Expand Down Expand Up @@ -330,6 +332,9 @@ export class Bot<
APIMethodParams<"getUpdates">
>["allowed_updates"];
} = {}) {
//TODO: maybe it useless??
this.info = await this.api.getMe();

if (!webhook) {
await this.api.deleteWebhook({
drop_pending_updates: dropPendingUpdates,
Expand Down

0 comments on commit 161ae65

Please sign in to comment.