Class PollingClient

Represents a client for handling Telegram updates using long polling.

Constructors

Properties

Methods

Constructors

  • Creates an instance of PollingClient.

    Parameters

    • client: TelegramClient

      The Telegram client instance.

    • Optionaloffset: number

      The initial offset for polling.

    Returns PollingClient

Properties

isClosed: boolean

Indicates whether the polling client is closed.

offset: number

The offset used to keep track of the latest updates.

Methods

  • Closes the polling client, stopping further updates.

    Returns boolean

    The closed state of the polling client.

  • Polls for new updates from Telegram.

    Parameters

    • options: undefined | {
          allowedUpdates?: readonly (
              | "poll"
              | "message"
              | "edited_message"
              | "channel_post"
              | "edited_channel_post"
              | "business_connection"
              | "business_message"
              | "edited_business_message"
              | "deleted_business_messages"
              | "message_reaction"
              | "message_reaction_count"
              | "inline_query"
              | "chosen_inline_result"
              | "callback_query"
              | "shipping_query"
              | "pre_checkout_query"
              | "poll_answer"
              | "my_chat_member"
              | "chat_member"
              | "chat_join_request"
              | "chat_boost"
              | "removed_chat_boost"
              | "purchased_paid_media")[];
          dropPendingUpdates?: boolean;
          limit?: number;
          offset?: number;
          timeout?: number;
      }

      The polling options.

    Returns Promise<void>

  • Starts the polling process to receive updates from Telegram.

    Parameters

    • Optionaloptions: {
          allowedUpdates?: readonly (
              | "poll"
              | "message"
              | "edited_message"
              | "channel_post"
              | "edited_channel_post"
              | "business_connection"
              | "business_message"
              | "edited_business_message"
              | "deleted_business_messages"
              | "message_reaction"
              | "message_reaction_count"
              | "inline_query"
              | "chosen_inline_result"
              | "callback_query"
              | "shipping_query"
              | "pre_checkout_query"
              | "poll_answer"
              | "my_chat_member"
              | "chat_member"
              | "chat_join_request"
              | "chat_boost"
              | "removed_chat_boost"
              | "purchased_paid_media")[];
          dropPendingUpdates?: boolean;
          limit?: number;
          offset?: number;
          timeout?: number;
      }

      The polling options.

      • OptionalallowedUpdates?: readonly (
            | "poll"
            | "message"
            | "edited_message"
            | "channel_post"
            | "edited_channel_post"
            | "business_connection"
            | "business_message"
            | "edited_business_message"
            | "deleted_business_messages"
            | "message_reaction"
            | "message_reaction_count"
            | "inline_query"
            | "chosen_inline_result"
            | "callback_query"
            | "shipping_query"
            | "pre_checkout_query"
            | "poll_answer"
            | "my_chat_member"
            | "chat_member"
            | "chat_join_request"
            | "chat_boost"
            | "removed_chat_boost"
            | "purchased_paid_media")[]
      • OptionaldropPendingUpdates?: boolean
      • Optionallimit?: number
      • Optionaloffset?: number
      • Optionaltimeout?: number

    Returns Promise<void>