Class ChatShared

Hierarchy (view full)

Constructors

  • Parameters

    • client: TelegramClient | BaseClient

      The client that instantiated this

    • data: ChatShared

      Data about the contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button

    Returns ChatShared

Properties

id: number

Identifier of the shared chat. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means.

photo?: Photo[]

Available sizes of the chat photo, if the photo was requested by the bot

requestId: number

Identifier of the request

title?: string

Title of the chat, if the title was requested by the bot.

username?: string

Username of the chat, if the username was requested by the bot and available.

Accessors

Methods

  • Protected

    Creates a clone of the current instance

    Returns Base

    A clone of the current instance

  • Protected

    Patches the current instance with new data

    Parameters

    • data: Record<string, any>

      The data to patch the instance with

    Returns Record<string, any>

    The patched data

  • Protected

    Updates the current instance with new data and returns a clone of the updated instance

    Parameters

    • data: Record<string, any>

      The data to update the instance with

    Returns Base

    A clone of the updated instance

  • Parameters

    Returns Promise<Collection<string, Message>>

  • Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correctOptionId is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages.

    Parameters

    • messageIds: (string | number)[]

      A list of 1-100 identifiers of messages in the chat fromChatId to copy. The identifiers must be specified in a strictly increasing order

    • chatId: string | number

      Unique identifier for the target chat or username of the target channel (in the format @channelusername)

    • Optionaloptions: Omit<{
          chatId: string | number;
          disableNotification?: boolean;
          fromChatId: string | number;
          messageIds: (string | number)[];
          messageThreadId?: string | number;
          protectContent?: boolean;
          removeCaption?: boolean;
      }, "chatId" | "fromChatId" | "messageIds">

      out parameters

    Returns Promise<number[]>

    On success, an array of MessageId of the sent messages is returned.

  • Use this method to delete a message, including service messages, with the following limitations:

    • A message can only be deleted if it was sent less than 48 hours ago.
    • Service messages about a supergroup, channel, or forum topic creation can't be deleted.
    • A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
    • Bots can delete outgoing messages in private chats, groups, and supergroups.
    • Bots can delete incoming messages in private chats.
    • Bots granted can_post_messages permissions can delete outgoing messages in channels.
    • If the bot is an administrator of a group, it can delete any message there.
    • If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.

    Parameters

    • id: string | number

      Identifier of the message to delete

    Returns Promise<true>

    Returns True on success.

  • Use this method to delete multiple messages simultaneously.

    Parameters

    • ids: (string | number)[]

      A list of 1-100 identifiers of messages to delete. See deleteMessage for limitations on which messages can be deleted

    Returns Promise<true>

    Returns True on success.

  • Checks if this chat is equal to another chat.

    Parameters

    • other: ChatShared

      The other object to compare with.

    Returns boolean

    True if both objects are instances of ChatShared and are equal based on key properties, otherwise false.

  • Fetches this chat

    Parameters

    • Optionaloptions: Omit<IFetchOptions, "cache" | "fullInfo"> & {
          fullInfo?: false;
      }

      options for fetch chat

    Returns Promise<Chat>

  • Fetches this chat

    Parameters

    • Optionaloptions: Omit<IFetchOptions, "cache" | "fullInfo"> & {
          fullInfo: true;
      }

      options for fetch chat

    Returns Promise<ChatFullInfo>

  • Fetches this chat

    Parameters

    • Optionaloptions: Omit<IFetchOptions, "cache">

      options for fetch chat

    Returns Promise<ChatFullInfo | Chat>

  • Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat.

    Parameters

    • userId: string | number

      Unique identifier of the target user.

    Returns Promise<UserChatBoosts>

    Returns a UserChatBoosts object.

  • Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages.

    Parameters

    • messageIds: (string | number)[]

      A list of 1-100 identifiers of messages in the chat fromChatId to forward. The identifiers must be specified in a strictly increasing order

    • chatId: string | number

      Unique identifier for the target chat or username of the target channel (in the format @channelusername)

    • Optionaloptions: Omit<{
          chatId: string | number;
          disableNotification?: boolean;
          fromChatId: string | number;
          messageIds: (string | number)[];
          messageThreadId?: string | number;
          protectContent?: boolean;
      }, "chatId" | "fromChatId" | "messageIds">

      out parameters

    Returns Promise<number[]>

    On success, an array of MessageId of the sent messages is returned.

  • Use this method for your bot to leave this group, supergroup or channel.

    Returns Promise<true>

    Returns True on success.

  • Retrieves the permissions of a specific member in the chat.

    Parameters

    • member: string | ChatMember

      The member object to check permissions for.

    • OptionalcheckAdmin: boolean

      A flag to check if the member is an admin or creator.

    Returns Promise<null | UserPermissions>

    The permissions object of the member or null if not available.

  • Use this method to get the number of members in a chat.

    Returns Promise<number>

    Returns Int on success.

  • Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel.

    Parameters

    • messageId: string | number

      Identifier of a message to pin

    • Optionaloptions: {
          businessConnectionId?: string;
          notification?: boolean;
      }

      Options for pinned message

      • OptionalbusinessConnectionId?: string

        Unique identifier of the business connection on behalf of which the message will be pinned

      • Optionalnotification?: boolean

        Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats

    Returns Promise<true>

    Returns True on success.

  • Use this method to send text messages.

    Parameters

    • text: string

      Text of the message to be sent, 1-4096 characters after entities parsing and media group options

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          entities?: MessageEntity[];
          linkPreviewOptions?: LinkPreviewOptions;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          text: string;
      }, "text" | "chatId" | "messageThreadId">

      out parameters

    Returns Promise<Message & {
        content: string;
    }>

    On success, the sent Message is returned.

  • Parameters

    • text: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          media: readonly (
              | InputMediaAudio
              | InputMediaDocument
              | InputMediaPhoto
              | InputMediaVideo)[];
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          replyParameters?: ReplyParameters;
      }, "chatId" | "messageThreadId">

    Returns Promise<(
        | Message & {
            audio: Audio;
        }
        | Message & {
            document: Document;
        }
        | Message & {
            photo: Photo;
        }
        | Message & {
            video: Video;
        })[]>

  • Parameters

    • text: string | Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          media: readonly (
              | InputMediaAudio
              | InputMediaDocument
              | InputMediaPhoto
              | InputMediaVideo)[];
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          replyParameters?: ReplyParameters;
      }, "chatId" | "messageThreadId">
    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          entities?: MessageEntity[];
          linkPreviewOptions?: LinkPreviewOptions;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          text: string;
      }, "text" | "chatId" | "messageThreadId">

    Returns Promise<Message & {
        content: string;
    } | (
        | Message & {
            audio: Audio;
        }
        | Message & {
            document: Document;
        }
        | Message & {
            photo: Photo;
        }
        | Message & {
            video: Video;
        })[]>

  • Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).

    Parameters

    • Optionalaction:
          | "typing"
          | "upload_photo"
          | "record_video"
          | "upload_video"
          | "record_voice"
          | "upload_voice"
          | "upload_document"
          | "choose_sticker"
          | "find_location"
          | "record_video_note"
          | "upload_video_note"

      Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes

    Returns Promise<true>

    Returns True on success.

  • Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).

    Parameters

    • animation:
          | string
          | ArrayBuffer
          | DataView
          | Uint8Array
          | Buffer
          | ReadStream
          | Blob
          | FormData

      Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data

    • Optionaloptions: Omit<{
          animation:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
          businessConnectionId?: string;
          caption?: string;
          captionEntities?: MessageEntity[];
          chatId: string | number;
          disableNotification?: boolean;
          duration?: number;
          hasSpoiler?: boolean;
          height?: number;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          showCaptionAboveMedia?: boolean;
          thumbnail?:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
          width?: number;
      }, "animation" | "chatId" | "messageThreadId">

      out parameters

    Returns Promise<Message & {
        animation: Animation;
    }>

    On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.

  • Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.

    Parameters

    • audio:
          | string
          | ArrayBuffer
          | DataView
          | Uint8Array
          | Buffer
          | ReadStream
          | Blob
          | FormData

      Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data

    • Optionaloptions: Omit<{
          audio:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
          businessConnectionId?: string;
          caption?: string;
          captionEntities?: MessageEntity[];
          chatId: string | number;
          disableNotification?: boolean;
          duration?: number;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          performer?: string;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          thumbnail?:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
          title?: string;
      }, "audio" | "chatId" | "messageThreadId">

      out parameters

    Returns Promise<Message & {
        audio: Audio;
    }>

    On success, the sent Message is returned.

  • Use this method to send phone contacts.

    Parameters

    • phoneNumber: string

      Contact's phone number

    • firstName: string

      Contact's first name

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          firstName: string;
          lastName?: string;
          messageEffectId?: string;
          messageThreadId?: string | number;
          phoneNumber: string;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          vcard?: string;
      }, "chatId" | "phoneNumber" | "firstName">

      out parameters

    Returns Promise<Message & {
        contact: Contact;
    }>

    On success, the sent Message is returned.

  • Use this method to send an animated emoji that will display a random value.

    Parameters

    • emoji: string

      Emoji on which the dice throw animation is based. Currently, must be one of "🎲", "🎯", "🏀", "⚽", "🎳", or "🎰". Dice can have values 1-6 for "🎲", "🎯" and "🎳", values 1-5 for "🏀" and "⚽", and values 1-64 for "🎰".

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          emoji?: string;
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
      }, "emoji" | "chatId" | "messageThreadId">

      out parameters

    Returns Promise<Message & {
        dice: Dice;
    }>

    On success, the sent Message is returned.

  • Use this method to send general files.

    Parameters

    • document:
          | string
          | ArrayBuffer
          | DataView
          | Uint8Array
          | Buffer
          | ReadStream
          | Blob
          | FormData

      File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          caption?: string;
          captionEntities?: MessageEntity[];
          chatId: string | number;
          disableContentTypeDetection?: boolean;
          disableNotification?: boolean;
          document:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          thumbnail?:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
      }, "document" | "chatId" | "messageThreadId">

      out parameters

    Returns Promise<Message & {
        document: Document;
    }>

    On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

  • Use this method to send a game.

    Parameters

    • gameShortName: string

      Short name of the game, serves as the unique identifier for the game. Set up your games via BotFather.

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          gameShortName: string;
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          replyMarkup?: InlineKeyboardMarkup;
          replyParameters?: ReplyParameters;
      }, "chatId" | "messageThreadId" | "gameShortName">

      out parameters

    Returns Promise<Message & {
        game: Game;
    }>

    On success, the sent Message is returned.

  • Use this method to send invoices.

    Parameters

    • title: string

      Product name, 1-32 characters

    • description: string

      Product description, 1-255 characters

    • payload: string

      Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes

    • currency: string

      Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars

    • prices: LabeledPrice[]

      Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars

    • Optionaloptions: Omit<{
          chatId: string | number;
          currency: string;
          description: string;
          disableNotification?: boolean;
          isFlexible?: boolean;
          maxTipAmount?: number;
          messageEffectId?: string;
          messageThreadId?: string | number;
          needEmail?: boolean;
          needName?: boolean;
          needPhoneNumber?: boolean;
          needShippingAddress?: boolean;
          payload: string;
          photoHeight?: number;
          photoSize?: number;
          photoUrl?: string;
          photoWidth?: number;
          prices: readonly LabeledPrice[];
          protectContent?: boolean;
          providerData?: string;
          providerToken?: string;
          replyMarkup?: InlineKeyboardMarkup;
          replyParameters?: ReplyParameters;
          sendEmailToProvider?: boolean;
          sendPhoneNumberToProvider?: boolean;
          startParameter?: string;
          suggestedTipAmounts?: number[];
          title: string;
      },
          | "currency"
          | "description"
          | "chatId"
          | "messageThreadId"
          | "title"
          | "payload"
          | "prices">

      out parameters

    Returns Promise<Message & {
        invoice: Invoice;
    }>

    On success, the sent Message is returned.

  • Use this method to send point on the map.

    Parameters

    • latitude: number

      Latitude of the location

    • longitude: number

      Longitude of the location

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          heading?: number;
          horizontalAccuracy?: number;
          latitude: number;
          livePeriod?: number;
          longitude: number;
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          proximityAlertRadius?: number;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
      },
          | "chatId"
          | "messageThreadId"
          | "latitude"
          | "longitude">

      out parameters

    Returns Promise<Message & {
        location: Location;
    }>

    On success, the sent Message is returned.

  • Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type.

    Parameters

    Returns Promise<(
        | Message & {
            audio: Audio;
        }
        | Message & {
            document: Document;
        }
        | Message & {
            photo: Photo;
        }
        | Message & {
            video: Video;
        })[]>

    On success, an array of Messages that were sent is returned.

  • Use this method to send paid media to channel chats.

    Parameters

    • media: InputPaidMedia[]

      An array describing the media to be sent; up to 10 items

    • starCount: number

      The number of Telegram Stars that must be paid to buy access to the media

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          caption?: string;
          captionEntities?: MessageEntity[];
          chatId: string | number;
          disableNotification?: boolean;
          media: InputPaidMedia[];
          parseMode?: string;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          showCaptionAboveMedia?: boolean;
          starCount: number;
      }, "media" | "chatId" | "starCount">

      out parameters

    Returns Promise<Message & {
        paidMedia: PaidMediaInfo;
    }>

    On success, the sent Message is returned.

  • Use this method to send photos.

    Parameters

    • photo:
          | string
          | ArrayBuffer
          | DataView
          | Uint8Array
          | Buffer
          | ReadStream
          | Blob
          | FormData

      Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          caption?: string;
          captionEntities?: MessageEntity[];
          chatId: string | number;
          disableNotification?: boolean;
          hasSpoiler?: boolean;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          photo:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          showCaptionAboveMedia?: boolean;
      }, "photo" | "chatId" | "messageThreadId">

      out parameters

    Returns Promise<Message & {
        photo: Photo[];
    }>

    On success, the sent Message is returned.

  • Use this method to send a native poll.

    Parameters

    • question: string

      Poll question, 1-300 characters

    • options: InputPollOption[]

      A list of 2-10 answer options

    • Optionalother: Omit<{
          allowsMultipleAnswers?: boolean;
          businessConnectionId?: string;
          chatId: string | number;
          closeDate?: number;
          correctOptionId?: number;
          disableNotification?: boolean;
          explanation?: string;
          explanationEntities?: MessageEntity[];
          explanationParseMode?: ParseMode;
          isAnonymous?: boolean;
          isClosed?: boolean;
          messageEffectId?: string;
          messageThreadId?: string | number;
          openPeriod?: number;
          options: InputPollOption[];
          protectContent?: boolean;
          question: string;
          questionEntities?: MessageEntity[];
          questionParseMode?: string;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          type?: "quiz" | "regular";
      },
          | "options"
          | "chatId"
          | "messageThreadId"
          | "question">

      out parameters

    Returns Promise<Message & {
        poll: Poll;
    }>

    On success, the sent Message is returned.

  • Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.

    Parameters

    • sticker:
          | string
          | ArrayBuffer
          | DataView
          | Uint8Array
          | Buffer
          | ReadStream
          | Blob
          | FormData

      Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. Video and animated stickers can't be sent via an HTTP URL

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          emoji?: string;
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          sticker:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
      }, "sticker" | "chatId" | "messageThreadId">

      out parameters

    Returns Promise<Message & {
        sticker: Sticker;
    }>

    On success, the sent Message is returned.

  • Use this method to send information about a venue.

    Parameters

    • latitude: number

      Latitude of the location

    • longitude: number

      Longitude of the location

    • options: Omit<{
          address: string;
          allowPaidBroadcast?: boolean;
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          foursquareId?: string;
          foursquareType?: string;
          googlePlaceId?: string;
          googlePlaceType?: string;
          latitude: number;
          longitude: number;
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          title: string;
      },
          | "chatId"
          | "messageThreadId"
          | "latitude"
          | "longitude">

      out parameters

    Returns Promise<Message & {
        venue: Venue;
    }>

    On success, the sent Message is returned.

  • Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document).

    Parameters

    • video:
          | string
          | ArrayBuffer
          | DataView
          | Uint8Array
          | Buffer
          | ReadStream
          | Blob
          | FormData

      Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data.

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          caption?: string;
          captionEntities?: MessageEntity[];
          chatId: string | number;
          disableNotification?: boolean;
          duration?: number;
          hasSpoiler?: boolean;
          height?: number;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          showCaptionAboveMedia?: boolean;
          supportsStreaming?: boolean;
          thumbnail?:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
          video:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
          width?: number;
      }, "video" | "chatId" | "messageThreadId">

      out parameters

    Returns Promise<Message & {
        video: Video;
    }>

    On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

  • Use this method to send video messages.

    Parameters

    • videoNote:
          | string
          | ArrayBuffer
          | DataView
          | Uint8Array
          | Buffer
          | ReadStream
          | Blob
          | FormData

      Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data.. Sending video notes by a URL is currently unsupported

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          chatId: string | number;
          disableNotification?: boolean;
          duration?: number;
          length?: number;
          messageEffectId?: string;
          messageThreadId?: string | number;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          thumbnail?:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
          videoNote:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
      }, "chatId" | "messageThreadId" | "videoNote">

      out parameters

    Returns Promise<Message & {
        videoNote: VideoNote;
    }>

    On success, the sent Message is returned.

  • Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document).

    Parameters

    • voice:
          | string
          | ArrayBuffer
          | DataView
          | Uint8Array
          | Buffer
          | ReadStream
          | Blob
          | FormData

      Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data

    • Optionaloptions: Omit<{
          businessConnectionId?: string;
          caption?: string;
          captionEntities?: MessageEntity[];
          chatId: string | number;
          disableNotification?: boolean;
          duration?: number;
          messageEffectId?: string;
          messageThreadId?: string | number;
          parseMode?: ParseMode;
          protectContent?: boolean;
          replyMarkup?:
              | InlineKeyboardMarkup
              | ForceReply
              | ReplyKeyboardMarkup
              | ReplyKeyboardRemove;
          replyParameters?: ReplyParameters;
          voice:
              | string
              | ArrayBuffer
              | DataView
              | Uint8Array
              | Buffer
              | ReadStream
              | Blob
              | FormData;
      }, "voice" | "chatId" | "messageThreadId">

      out parameters

    Returns Promise<Message & {
        voice: Voice;
    }>

    On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

  • Use this method to change the bot's menu button in a private chat, or the default menu button.

    Parameters

    • OptionalmenuButton: MenuButton

      An object for the bot's new menu button. Defaults to MenuButtonDefault

    Returns Promise<true>

    Returns True on success.

  • Flatten an object. Any properties that are collections will get converted to an array of keys.

    Parameters

    • OptionalpropsRecursive: boolean

      Optional. If true, calls toJSON method on nested objects.

    • Rest...props: Record<string, string | boolean>[]

      Optional. Specific properties to include/exclude, or rename.

    Returns Record<string, any>

    Flattened object.

  • Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel.

    Returns Promise<true>

    Returns True on success.

  • Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel.

    Parameters

    • Optionaloptions: {
          businessConnectionId?: string;
          messageId?: boolean;
      }

      Options for unpinned message

      • OptionalbusinessConnectionId?: string

        Unique identifier of the business connection on behalf of which the message will be pinned

      • OptionalmessageId?: boolean

        Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the most recent pinned message (by sending date) will be pinned

    Returns Promise<true>

    Returns True on success.

  • Returns the id instance Chat, User, ChatMember and other

    Returns null | string