Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@telegraf/types

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@telegraf/types - npm Package Compare versions

Comparing version 6.9.1 to 7.0.0

2

api.d.ts

@@ -18,3 +18,3 @@ export interface ApiError {

export interface ResponseParameters {
/** The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
/** The group has been migrated to a supergroup with the specified identifier. */
migrate_to_chat_id?: number;

@@ -21,0 +21,0 @@ /** In case of exceeding flood control, the number of seconds left to wait before the request can be repeated */

import type { Chat, User } from "./manage.js";
import type { InlineKeyboardMarkup, WebAppInfo } from "./markup.js";
import type { Location, MessageEntity, ParseMode } from "./message.js";
import type { LinkPreviewOptions, Location, MessageEntity, ParseMode } from "./message.js";
import type { LabeledPrice } from "./payment.js";

@@ -576,4 +576,4 @@ /** This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. */

entities?: MessageEntity[];
/** Disables link previews for links in the sent message */
disable_web_page_preview?: boolean;
/** Options used for link preview generation for the original message, if it is a text message */
link_preview_options?: LinkPreviewOptions;
}

@@ -580,0 +580,0 @@ /** Represents the content of a location message to be sent as the result of an inline query. */

@@ -25,3 +25,3 @@ import type { Location, Message, PhotoSize } from "./message.js";

export interface User {
/** Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. */
/** Unique identifier for this user or bot. */
id: number;

@@ -57,3 +57,3 @@ /** True, if this user is a bot */

interface AbstractChat {
/** Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
/** Unique identifier for this chat. */
id: number;

@@ -106,3 +106,3 @@ /** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */

}
/** Internal type holding properties that those private, supergroup, and channel chats returned from `getChat` share. */
/** Internal type holding properties that private, supergroup, and channel chats returned from `getChat` share. */
interface NonGroupGetChat extends GetChat {

@@ -112,4 +112,6 @@ /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat. */

}
/** Internal type holding properties that those group, supergroup, and channel chats returned from `getChat` share. */
/** Internal type holding properties that group, supergroup, and channel chats returned from `getChat` share. */
interface NonPrivateGetChat extends GetChat {
/** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. Returned only in getChat. */
available_reactions?: ReactionType[];
/** Description, for groups, supergroups and channel chats. Returned only in getChat. */

@@ -120,4 +122,4 @@ description?: string;

}
/** Internal type holding properties that those group and supergroup chats returned from `getChat` share. */
interface MultiUserGetChat extends NonPrivateGetChat {
/** Internal type holding properties that group and supergroup chats returned from `getChat` share. */
interface AnyGroupGetChat extends NonPrivateGetChat {
/** Default chat member permissions, for groups and supergroups. Returned only in getChat. */

@@ -128,13 +130,20 @@ permissions?: ChatPermissions;

}
/** Internal type holding properties that those supergroup and channel chats returned from `getChat` share. */
/** Internal type holding properties that private and channel chats returned from `getChat` share. */
interface PrivateAndChannelGetChat {
/** Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. Returned only in getChat. */
accent_color_id: number;
/** Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat. */
background_custom_emoji_id?: string;
/** Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. */
emoji_status_custom_emoji_id?: string;
/** Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat. */
emoji_status_expiration_date?: number;
}
/** Internal type holding properties that supergroup and channel chats returned from `getChat` share. */
interface LargeGetChat extends NonPrivateGetChat {
/** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat. */
/** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. Returned only in getChat. */
linked_chat_id?: number;
}
/** Internal type representing private chats returned from `getChat`. */
interface PrivateGetChat extends PrivateChat, NonGroupGetChat, GetChat {
/** Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. */
emoji_status_custom_emoji_id?: string;
/** Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat. */
emoji_status_expiration_date?: number;
interface PrivateGetChat extends PrivateChat, NonGroupGetChat, PrivateAndChannelGetChat {
/** Bio of the other party in a private chat. Returned only in getChat. */

@@ -148,6 +157,6 @@ bio?: string;

/** Internal type representing group chats returned from `getChat`. */
interface GroupGetChat extends GroupChat, MultiUserGetChat {
interface GroupGetChat extends GroupChat, AnyGroupGetChat {
}
/** Internal type representing supergroup chats returned from `getChat`. */
interface SupergroupGetChat extends SupergroupChat, NonGroupGetChat, MultiUserGetChat, LargeGetChat {
interface SupergroupGetChat extends SupergroupChat, NonGroupGetChat, AnyGroupGetChat, LargeGetChat {
/** True, if users need to join the supergroup before they can send messages. Returned only in getChat. */

@@ -161,2 +170,4 @@ join_to_send_messages?: true;

has_aggressive_anti_spam_enabled?: true;
/** True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat. */
has_visible_history?: boolean;
/** For supergroups, name of group sticker set. Returned only in getChat. */

@@ -168,3 +179,7 @@ sticker_set_name?: string;

/** Internal type representing channel chats returned from `getChat`. */
interface ChannelGetChat extends ChannelChat, NonGroupGetChat, LargeGetChat {
interface ChannelGetChat extends ChannelChat, NonGroupGetChat, LargeGetChat, PrivateAndChannelGetChat {
/** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. Returned only in getChat. */
profile_accent_color_id?: number;
/** Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat. */
profile_background_custom_emoji_id?: string;
}

@@ -256,8 +271,11 @@ }

export type ChatMember = ChatMemberOwner | ChatMemberAdministrator | ChatMemberMember | ChatMemberRestricted | ChatMemberLeft | ChatMemberBanned;
export interface AbstractChatMember {
/** The member's status in the chat */
status: string;
/** Information about the user */
user: User;
}
/** Represents a chat member that owns the chat and has all administrator privileges. */
export interface ChatMemberOwner {
/** The member's status in the chat, always “creator” */
export interface ChatMemberOwner extends AbstractChatMember {
status: "creator";
/** Information about the user */
user: User;
/** True, if the user's presence in the chat is hidden */

@@ -269,7 +287,4 @@ is_anonymous: boolean;

/** Represents a chat member that has some additional privileges. */
export interface ChatMemberAdministrator {
/** The member's status in the chat, always “administrator” */
export interface ChatMemberAdministrator extends AbstractChatMember {
status: "administrator";
/** Information about the user */
user: User;
/** True, if the bot is allowed to edit administrator privileges of that user */

@@ -311,17 +326,11 @@ can_be_edited: boolean;

/** Represents a chat member that has no additional privileges or restrictions. */
export interface ChatMemberMember {
/** The member's status in the chat, always “member” */
export interface ChatMemberMember extends AbstractChatMember {
status: "member";
/** Information about the user */
user: User;
}
/** Represents a chat member that is under certain restrictions in the chat. Supergroups only. */
export interface ChatMemberRestricted {
/** The member's status in the chat, always “restricted” */
export interface ChatMemberRestricted extends AbstractChatMember {
status: "restricted";
/** Information about the user */
user: User;
/** True, if the user is a member of the chat at the moment of the request */
is_member: boolean;
/** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
/** True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues */
can_send_messages: boolean;

@@ -358,14 +367,8 @@ /** True, if the user is allowed to send audios */

/** Represents a chat member that isn't currently a member of the chat, but may join it themselves. */
export interface ChatMemberLeft {
/** The member's status in the chat, always “left” */
export interface ChatMemberLeft extends AbstractChatMember {
status: "left";
/** Information about the user */
user: User;
}
/** Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. */
export interface ChatMemberBanned {
/** The member's status in the chat, always “kicked” */
export interface ChatMemberBanned extends AbstractChatMember {
status: "kicked";
/** Information about the user */
user: User;
/** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever */

@@ -397,3 +400,3 @@ until_date: number;

from: User;
/** Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user. */
/** Identifier of a private chat with the user who sent the join request. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user. */
user_chat_id: number;

@@ -409,3 +412,3 @@ /** Date the request was sent in Unix time */

export interface ChatPermissions {
/** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
/** True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues */
can_send_messages?: boolean;

@@ -446,2 +449,59 @@ /** True, if the user is allowed to send audios */

}
/** This object describes the type of a reaction. Currently, it can be one of
* - ReactionTypeEmoji
* - ReactionTypeCustomEmoji
*/
export type ReactionType = ReactionTypeEmoji | ReactionTypeCustomEmoji;
export interface AbstractReactionType {
/** Type of the reaction */
type: string;
}
export type TelegramEmoji = "👍" | "👎" | "❤" | "🔥" | "🥰" | "👏" | "😁" | "🤔" | "🤯" | "😱" | "🤬" | "😢" | "🎉" | "🤩" | "🤮" | "💩" | "🙏" | "👌" | "🕊" | "🤡" | "🥱" | "🥴" | "😍" | "🐳" | "❤‍🔥" | "🌚" | "🌭" | "💯" | "🤣" | "⚡" | "🍌" | "🏆" | "💔" | "🤨" | "😐" | "🍓" | "🍾" | "💋" | "🖕" | "😈" | "😴" | "😭" | "🤓" | "👻" | "👨‍💻" | "👀" | "🎃" | "🙈" | "😇" | "😨" | "🤝" | "✍" | "🤗" | "🫡" | "🎅" | "🎄" | "☃" | "💅" | "🤪" | "🗿" | "🆒" | "💘" | "🙉" | "🦄" | "😘" | "💊" | "🙊" | "😎" | "👾" | "🤷‍♂" | "🤷" | "🤷‍♀" | "😡";
/** The reaction is based on an emoji. */
export interface ReactionTypeEmoji extends AbstractReactionType {
type: "emoji";
/** Reaction emoji. */
emoji: TelegramEmoji;
}
/** The reaction is based on a custom emoji. */
export interface ReactionTypeCustomEmoji extends AbstractReactionType {
type: "custom_emoji";
/** Custom emoji identifier */
custom_emoji_id: string;
}
/** Represents a reaction added to a message along with the number of times it was added. */
export interface ReactionCount {
/** Type of the reaction */
type: ReactionType;
/** Number of times the reaction was added */
total_count: number;
}
/** This object represents a change of a reaction on a message performed by a user. */
export interface MessageReactionUpdated {
/** The chat containing the message the user reacted to */
chat: Chat;
/** Unique identifier of the message inside the chat */
message_id: number;
/** The user that changed the reaction, if the user isn't anonymous */
user?: User;
/** The chat on behalf of which the reaction was changed, if the user is anonymous */
actor_chat?: Chat;
/** Date of the change in Unix time */
date: number;
/** Previous list of reaction types that were set by the user */
old_reaction: ReactionType[];
/** New list of reaction types that have been set by the user */
new_reaction: ReactionType[];
}
/** This object represents reaction changes on a message with anonymous reactions. */
export interface MessageReactionCountUpdated {
/** The chat containing the message */
chat: Chat;
/** Unique message identifier inside the chat */
message_id: number;
/** Date of the change in Unix time */
date: number;
/** List of reactions that are present on the message */
reactions: ReactionCount[];
}
/** This object represents a forum topic. */

@@ -465,3 +525,73 @@ export interface ForumTopic {

}
/** This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. */
/** This object describes the source of a chat boost. It can be one of
- ChatBoostSourcePremium
- ChatBoostSourceGiftCode
- ChatBoostSourceGiveaway
*/
type ChatBoostSource = ChatBoostSourcePremium | ChatBoostSourceGiftCode | ChatBoostSourceGiveaway;
export interface AbstractChatBoostSource {
/** Source of the boost */
source: string;
}
/** The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user. */
export interface ChatBoostSourcePremium extends AbstractChatBoostSource {
source: "premium";
/** User that boosted the chat. */
user: User;
}
/** The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. */
export interface ChatBoostSourceGiftCode extends AbstractChatBoostSource {
source: "gift_code";
/** User for which the gift code was created. */
user: User;
}
/** The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. */
export interface ChatBoostSourceGiveaway extends AbstractChatBoostSource {
source: "giveaway";
/** Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet. */
giveaway_message_id: number;
/** User that won the prize in the giveaway if any. */
user?: User;
/** True, if the giveaway was completed, but there was no user to win the prize */
is_unclaimed?: true;
}
/** This object contains information about a chat boost. */
export interface ChatBoost {
/** Unique identifier of the boost */
boost_id: string;
/** Point in time (Unix timestamp) when the chat was boosted */
add_date: number;
/** Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged */
expiration_date: number;
/** Source of the added boost */
source: ChatBoostSource;
}
/** This object represents a boost added to a chat or changed. */
export interface ChatBoostUpdated {
/** Chat which was boosted */
chat: Chat;
/** Infomation about the chat boost */
boost: ChatBoost;
}
/** This object represents a boost removed from a chat. */
export interface ChatBoostRemoved {
/** Chat which was boosted */
chat: Chat;
/** Unique identifier of the boost */
boost_id: string;
/** Point in time (Unix timestamp) when the boost was removed */
remove_date: number;
/** Source of the removed boost */
source: ChatBoostSource;
}
/** This object represents a list of boosts added to a chat by a user. */
export interface UserChatBoosts {
/** The list of boosts added to the chat by the user */
boosts: ChatBoost[];
}
/** This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.
> The maximum file size to download is 20 MB
*/
export interface File {

@@ -472,6 +602,7 @@ /** Identifier for this file, which can be used to download or reuse the file */

file_unique_id: string;
/** File size in bytes */
/** File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value. */
file_size?: number;
/** File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. */
/** File path. Use `https://api.telegram.org/file/bot<token>/<file_path>` to get the file. */
file_path?: string;
}
export {};
import type { ChatAdministratorRights, User } from "./manage.js";
import type { Message } from "./message.js";
import type { MaybeInaccessibleMessage } from "./message.js";
/** This object represents an inline keyboard that appears right next to the message it belongs to. */

@@ -94,4 +94,4 @@ export interface InlineKeyboardMarkup {

from: User;
/** Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old */
message?: Message;
/** Message sent by the bot with the callback button that originated the query */
message?: MaybeInaccessibleMessage;
/** Identifier of the message sent via the bot in inline mode, that originated the query. */

@@ -137,5 +137,5 @@ inline_message_id?: string;

}
interface RequestUserButton extends CommonButton {
/** If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a “user_shared” service message. Available in private chats only. */
request_user: KeyboardButtonRequestUser;
interface RequestUsersButton extends CommonButton {
/** If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. */
request_users: KeyboardButtonRequestUsers;
}

@@ -164,3 +164,3 @@ interface RequestChatButton extends CommonButton {

/** This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_user, request_chat, request_contact, request_location, and request_poll are mutually exclusive. */
export type KeyboardButton = KeyboardButton.CommonButton | KeyboardButton.RequestUserButton | KeyboardButton.RequestChatButton | KeyboardButton.RequestContactButton | KeyboardButton.RequestLocationButton | KeyboardButton.RequestPollButton | KeyboardButton.WebAppButton | string;
export type KeyboardButton = KeyboardButton.CommonButton | KeyboardButton.RequestUsersButton | KeyboardButton.RequestChatButton | KeyboardButton.RequestContactButton | KeyboardButton.RequestLocationButton | KeyboardButton.RequestPollButton | KeyboardButton.WebAppButton | string;
/** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */

@@ -202,10 +202,12 @@ export interface KeyboardButtonPollType {

}
/** This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed. */
export interface KeyboardButtonRequestUser {
/** Signed 32-bit identifier of the request, which will be received back in the UserShared object. Must be unique within the message */
/** This object defines the criteria used to request suitable users. The identifiers of the selected users will be shared with the bot when the corresponding button is pressed. */
export interface KeyboardButtonRequestUsers {
/** Signed 32-bit identifier of the request that will be received back in the UsersShared object. Must be unique within the message. */
request_id: number;
/** Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied. */
/** Pass True to request bots, pass False to request regular users. If not specified, no additional restrictions are applied. */
user_is_bot?: boolean;
/** Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied. */
/** Pass True to request premium users, pass False to request non-premium users. If not specified, no additional restrictions are applied. */
user_is_premium?: boolean;
/** The maximum number of users to be selected; 1-10. Defaults to 1. */
max_quantity?: number;
}

@@ -212,0 +214,0 @@ /** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. */

@@ -15,5 +15,5 @@ import type { Chat, File, User } from "./manage.js";

sender_chat?: Chat;
/** Date the message was sent in Unix time */
/** Date the message was sent in Unix time. It is always a positive number, representing a valid date. */
date: number;
/** Conversation the message belongs to */
/** Chat the message belongs to */
chat: Chat;

@@ -24,18 +24,12 @@ /** True, if the message is sent to a forum topic */

interface CommonMessage extends ServiceMessage {
/** For forwarded messages, sender of the original message */
forward_from?: User;
/** For messages forwarded from channels or from anonymous administrators, information about the original sender chat */
forward_from_chat?: Chat;
/** For messages forwarded from channels, identifier of the original message in the channel */
forward_from_message_id?: number;
/** For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */
forward_signature?: string;
/** Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */
forward_sender_name?: string;
/** For forwarded messages, date the original message was sent in Unix time */
forward_date?: number;
/** Information about the original message for forwarded messages */
forward_origin?: MessageOrigin;
/** True, if the message is a channel post that was automatically forwarded to the connected discussion group */
is_automatic_forward?: true;
/** For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
/** For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
reply_to_message?: ReplyMessage;
/** Information about the message that is being replied to, which may come from another chat or forum topic */
external_reply?: ExternalReplyInfo;
/** For replies that quote part of the original message, the quoted part of the message */
quote?: TextQuote;
/** Bot through which the message was sent */

@@ -49,2 +43,4 @@ via_bot?: User;

author_signature?: string;
/** Options used for link preview generation for the message, if it is a text message and link preview options were changed */
link_preview_options?: LinkPreviewOptions;
/** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */

@@ -168,7 +164,7 @@ reply_markup?: InlineKeyboardMarkup;

interface MigrateToChatIdMessage extends ServiceMessage {
/** The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
/** The group has been migrated to a supergroup with the specified identifier. */
migrate_to_chat_id: number;
}
interface MigrateFromChatIdMessage extends ServiceMessage {
/** The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
/** The supergroup has been migrated from a group with the specified identifier. */
migrate_from_chat_id: number;

@@ -178,3 +174,3 @@ }

/** Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */
pinned_message: ReplyMessage;
pinned_message: Omit<MaybeInaccessibleMessage, "reply_to_message">;
}

@@ -189,5 +185,5 @@ interface InvoiceMessage extends ServiceMessage {

}
interface UserSharedMessage extends ServiceMessage {
interface UsersSharedMessage extends ServiceMessage {
/** Service message: a user was shared with the bot */
user_shared: UserShared;
users_shared: UsersShared;
}

@@ -238,2 +234,18 @@ interface ChatSharedMessage extends ServiceMessage {

}
interface GiveawayCreatedMessage extends ServiceMessage {
/** Service message: a scheduled giveaway was created */
giveaway_created: GiveawayCreated;
}
interface GiveawayMessage extends ServiceMessage {
/** The message is a scheduled giveaway message */
giveaway: Giveaway;
}
interface GiveawayWinnersMessage extends ServiceMessage {
/** A giveaway with public winners was completed */
giveaway_winners: GiveawayWinners;
}
interface GiveawayCompletedMessage extends ServiceMessage {
/** Service message: a giveaway without public winners was completed */
giveaway_completed: GiveawayCompleted;
}
interface VideoChatScheduledMessage extends ServiceMessage {

@@ -261,3 +273,3 @@ /** Service message: video chat scheduled */

/** Helper type that bundles all possible `Message.ServiceMessage`s. More specifically, bundles all messages that do not have a `reply_to_message` field, i.e. are not a `Message.CommonMessage`. */
export type ServiceMessageBundle = Message.NewChatMembersMessage | Message.LeftChatMemberMessage | Message.NewChatTitleMessage | Message.NewChatPhotoMessage | Message.DeleteChatPhotoMessage | Message.GroupChatCreatedMessage | Message.SupergroupChatCreated | Message.ChannelChatCreatedMessage | Message.MessageAutoDeleteTimerChangedMessage | Message.MigrateToChatIdMessage | Message.MigrateFromChatIdMessage | Message.PinnedMessageMessage | Message.InvoiceMessage | Message.SuccessfulPaymentMessage | Message.UserSharedMessage | Message.ChatSharedMessage | Message.ConnectedWebsiteMessage | Message.WriteAccessAllowedMessage | Message.PassportDataMessage | Message.ProximityAlertTriggeredMessage | Message.ForumTopicCreatedMessage | Message.ForumTopicEditedMessage | Message.ForumTopicClosedMessage | Message.ForumTopicReopenedMessage | Message.GeneralForumTopicHiddenMessage | Message.GeneralForumTopicUnhiddenMessage | Message.VideoChatScheduledMessage | Message.VideoChatStartedMessage | Message.VideoChatEndedMessage | Message.VideoChatParticipantsInvitedMessage | Message.WebAppDataMessage;
export type ServiceMessageBundle = Message.NewChatMembersMessage | Message.LeftChatMemberMessage | Message.NewChatTitleMessage | Message.NewChatPhotoMessage | Message.DeleteChatPhotoMessage | Message.GroupChatCreatedMessage | Message.SupergroupChatCreated | Message.ChannelChatCreatedMessage | Message.MessageAutoDeleteTimerChangedMessage | Message.MigrateToChatIdMessage | Message.MigrateFromChatIdMessage | Message.PinnedMessageMessage | Message.InvoiceMessage | Message.SuccessfulPaymentMessage | Message.UsersSharedMessage | Message.ChatSharedMessage | Message.ConnectedWebsiteMessage | Message.WriteAccessAllowedMessage | Message.PassportDataMessage | Message.ProximityAlertTriggeredMessage | Message.ForumTopicCreatedMessage | Message.ForumTopicEditedMessage | Message.ForumTopicClosedMessage | Message.ForumTopicReopenedMessage | Message.GeneralForumTopicHiddenMessage | Message.GeneralForumTopicUnhiddenMessage | Message.GiveawayCreatedMessage | Message.GiveawayMessage | Message.GiveawayWinnersMessage | Message.GiveawayCompletedMessage | Message.VideoChatScheduledMessage | Message.VideoChatStartedMessage | Message.VideoChatEndedMessage | Message.VideoChatParticipantsInvitedMessage | Message.WebAppDataMessage;
/** Helper type that bundles all possible `Message.CommonMessage`s. More specifically, bundles all messages that do have a `reply_to_message` field, i.e. are a `Message.CommonMessage`. */

@@ -276,2 +288,16 @@ export type CommonMessageBundle = Message.AnimationMessage | Message.AudioMessage | Message.ContactMessage | Message.DiceMessage | Message.DocumentMessage | Message.GameMessage | Message.LocationMessage | Message.PhotoMessage | Message.PollMessage | Message.StickerMessage | Message.StoryMessage | Message.TextMessage | Message.VenueMessage | Message.VideoMessage | Message.VideoNoteMessage | Message.VoiceMessage;

}
/** This object describes a message that was deleted or is otherwise inaccessible to the bot. */
export interface InaccessibleMessage {
/** Chat the message belonged to. */
chat: Chat;
/** Unique message identifier inside the chat. */
message_id: number;
/** Always 0. The field can be used to differentiate regular and inaccessible messages. */
date: 0;
}
/** This object describes a message that can be inaccessible to the bot. It can be one of
- Message
- InaccessibleMessage */
export type MaybeInaccessibleMessage = Message | InaccessibleMessage;
/** Describes an inline message sent by a Web App on behalf of a user. */

@@ -282,3 +308,3 @@ export interface SentWebAppMessage {

}
/** The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, and spoiler text, as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting.
/** The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, spoiler text, block quotations as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can specify text entities directly, or use markdown-style or HTML-style formatting.

@@ -290,2 +316,3 @@ Note that Telegram clients will display an **alert** to the user before opening an inline link ('Open this link?' together with the full URL).

- bold, italic, underline, strikethrough, and spoiler entities can contain and can be part of any other entities, except pre and code.
- blockquote entities can't be nested.
- All other entities can't contain each other.

@@ -298,2 +325,4 @@

You can find the list of programming and markup languages for which syntax highlighting is supported at [libprisma#supported-languages](https://github.com/TelegramMessenger/libprisma#supported-languages).
#### MarkdownV2 style

@@ -303,3 +332,3 @@ To use this mode, pass *MarkdownV2* in the *parse_mode* field. Use the following syntax in your message:

```
*bold \*text*
*bold \*text*
_italic \*text_

@@ -320,2 +349,5 @@ __underline__

`​`​`
>Block quotation started
>Block quotation continued
>The last line of the block quotation
```

@@ -348,2 +380,3 @@ Please note:

<pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>
<blockquote>Block quotation started\nBlock quotation continued\nThe last line of the block quotation</blockquote>
```

@@ -365,3 +398,3 @@ Please note:

```
*bold text*
*bold text*
_italic text_

@@ -381,3 +414,3 @@ [inline URL](http://www.example.com/)

- Entities must not be nested, use parse mode MarkdownV2 instead.
- There is no way to specify underline and strikethrough entities, use parse mode MarkdownV2 instead.
- There is no way to specify “underline”, “strikethrough”, “spoiler”, “blockquote” and “custom_emoji” entities, use parse mode MarkdownV2 instead.
- To escape characters '_', '*', '`', '[' outside of an entity, prepend the characters '\' before them.

@@ -388,3 +421,3 @@ - Escaping inside entities is not allowed, so entity must be closed first and reopened again: use `_snake_\__case_` for italic `snake_case` and `*2*\**2=4*` for bold `2*2=4`. */

interface AbstractMessageEntity {
/** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */
/** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */
type: string;

@@ -397,3 +430,3 @@ /** Offset in UTF-16 code units to the start of the entity */

interface CommonMessageEntity extends AbstractMessageEntity {
type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "code";
type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "blockquote" | "italic" | "underline" | "strikethrough" | "spoiler" | "code";
}

@@ -423,2 +456,164 @@ interface PreMessageEntity extends AbstractMessageEntity {

export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity;
/** This object contains information about the quoted part of a message that is replied to by the given message. */
export interface TextQuote {
/** Text of the quoted part of a message that is replied to by the given message */
text: string;
/** Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes. */
entities?: MessageEntity[];
/** Approximate quote position in the original message in UTF-16 code units as specified by the sender */
position: number;
/** True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server. */
is_manual?: true;
}
/** Base properties shared by all ExternalReplyInfo variants */
export interface AbstractExternalReply {
/** Origin of the message replied to by the given message */
origin: MessageOrigin;
/** Chat the original message belongs to. Available only if the chat is a supergroup or a channel. */
chat?: Chat;
/** Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel. */
message_id?: number;
/** Options used for link preview generation for the original message, if it is a text message */
link_preview_options?: LinkPreviewOptions;
}
/** Properties shared by Animation, Photo, and Video ExternalReplyInfo */
export interface AbstractExternalReplyMedia {
/** True, if the message media is covered by a spoiler animation */
has_media_spoiler?: true;
}
export interface ExternalReplyAnimation extends AbstractExternalReply, AbstractExternalReplyMedia {
/** Message is an animation, information about the animation */
animation: Animation;
}
export interface ExternalReplyAudio extends AbstractExternalReply {
/** Message is an audio file, information about the file */
audio: Audio;
}
export interface ExternalReplyDocument extends AbstractExternalReply {
/** Message is a general file, information about the file */
document: Document;
}
export interface ExternalReplyPhoto extends AbstractExternalReply, AbstractExternalReplyMedia {
/** Message is a photo, available sizes of the photo */
photo: PhotoSize[];
}
export interface ExternalReplySticker extends AbstractExternalReply {
/** Message is a sticker, information about the sticker */
sticker: Sticker;
}
export interface ExternalReplyStory extends AbstractExternalReply {
/** Message is a forwarded story */
story: Story;
}
export interface ExternalReplyVideo extends AbstractExternalReply, AbstractExternalReplyMedia {
/** Message is a video, information about the video */
video: Video;
}
export interface ExternalReplyVideoNote extends AbstractExternalReply {
/** Message is a video note, information about the video message */
video_note: VideoNote;
}
export interface ExternalReplyVoice extends AbstractExternalReply {
/** Message is a voice message, information about the file */
voice: Voice;
}
export interface ExternalReplyContact extends AbstractExternalReply {
/** Message is a shared contact, information about the contact */
contact: Contact;
}
export interface ExternalReplyDice extends AbstractExternalReply {
/** Message is a dice with random value */
dice: Dice;
}
export interface ExternalReplyGame extends AbstractExternalReply {
/** Message is a game, information about the game. More about games » */
game: Game;
}
export interface ExternalReplyGiveaway extends AbstractExternalReply {
/** Message is a scheduled giveaway, information about the giveaway */
giveaway: Giveaway;
}
export interface ExternalReplyGiveawayWinners extends AbstractExternalReply {
/** A giveaway with public winners was completed */
giveaway_winners: GiveawayWinners;
}
export interface ExternalReplyInvoice extends AbstractExternalReply {
/** Message is an invoice for a payment, information about the invoice. More about payments » */
invoice: Invoice;
}
export interface ExternalReplyLocation extends AbstractExternalReply {
/** Message is a shared location, information about the location */
location: Location;
}
export interface ExternalReplyPoll extends AbstractExternalReply {
/** Message is a native poll, information about the poll */
poll: Poll;
}
export interface ExternalReplyVenue extends AbstractExternalReply {
/** Message is a venue, information about the venue */
venue: Venue;
}
/** This object contains information about a message that is being replied to, which may come from another chat or forum topic. */
export type ExternalReplyInfo = ExternalReplyAnimation | ExternalReplyAudio | ExternalReplyDocument | ExternalReplyPhoto | ExternalReplySticker | ExternalReplyStory | ExternalReplyVideo | ExternalReplyVideoNote | ExternalReplyVoice | ExternalReplyContact | ExternalReplyDice | ExternalReplyGame | ExternalReplyGiveaway | ExternalReplyGiveawayWinners | ExternalReplyInvoice | ExternalReplyLocation | ExternalReplyPoll | ExternalReplyVenue;
/** Describes reply parameters for the message that is being sent. */
export interface ReplyParameters {
/** Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified */
message_id: number;
/** If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format `@channelusername`) */
chat_id?: number | string;
/** Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic. */
allow_sending_without_reply?: boolean;
/** Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn't found in the original message. */
quote?: string;
/** Mode for parsing entities in the quote. See formatting options for more details. */
quote_parse_mode?: string;
/** A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode. */
quote_entities?: MessageEntity[];
/** Position of the quote in the original message in UTF-16 code units */
quote_position?: number;
}
/** This object describes the origin of a message. It can be one of
- MessageOriginUser
- MessageOriginHiddenUser
- MessageOriginChat
- MessageOriginChannel
*/
type MessageOrigin = MessageOriginUser | MessageOriginHiddenUser | MessageOriginChat | MessageOriginChannel;
export interface AbstractMessageOrigin {
/** Type of the message origin */
type: string;
/** Date the message was sent originally in Unix time */
date: number;
}
/** The message was originally sent by a known user. */
export interface MessageOriginUser {
type: "user";
/** User that sent the message originally */
sender_user: User;
}
/** The message was originally sent by an unknown user. */
export interface MessageOriginHiddenUser {
type: "hidden_user";
/** Name of the user that sent the message originally */
sender_user_name: string;
}
/** The message was originally sent on behalf of a chat to a group chat. */
export interface MessageOriginChat {
type: "chat";
/** Chat that sent the message originally */
sender_chat: Chat;
/** For messages originally sent by an anonymous chat administrator, original message author signature */
author_signature?: string;
}
/** The message was originally sent to a channel chat. */
export interface MessageOriginChannel {
type: "channel";
/** Channel chat to which the message was originally sent */
chat: Chat;
/** Unique message identifier inside the chat */
message_id: number;
/** Signature of the original post author */
author_signature?: string;
}
/** This object represents one size of a photo or a file / sticker thumbnail. */

@@ -551,3 +746,3 @@ export interface PhotoSize {

last_name?: string;
/** Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. */
/** Contact's user identifier in Telegram. */
user_id?: number;

@@ -696,8 +891,8 @@ /** Additional data about the contact in the form of a vCard */

}
/** This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button. */
export interface UserShared {
/** This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUsers button. */
export interface UsersShared {
/** Identifier of the request */
request_id: number;
/** Identifier of the shared user. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means. */
user_id: number;
/** Identifiers of the shared users. The bot may not have access to the users and could be unable to use these identifiers, unless the users are already known to the bot by some other means. */
user_ids: number[];
}

@@ -708,3 +903,3 @@ /** This object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button. */

request_id: number;
/** Identifier of the shared chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. 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. */
/** 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. */
chat_id: number;

@@ -739,2 +934,71 @@ }

}
/** This object represents a service message about the creation of a scheduled giveaway. Currently holds no information. */
export interface GiveawayCreated {
}
/** This object represents a message about a scheduled giveaway. */
export interface Giveaway {
/** The list of chats which the user must join to participate in the giveaway */
chats: Chat[];
/** Point in time (Unix timestamp) when winners of the giveaway will be selected */
winners_selection_date: number;
/** The number of users which are supposed to be selected as winners of the giveaway */
winner_count: number;
/** True, if only users who join the chats after the giveaway started should be eligible to win */
only_new_members?: true;
/** True, if the list of giveaway winners will be visible to everyone */
has_public_winners?: true;
/** Description of additional giveaway prize */
prize_description?: string;
/** A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways. */
country_codes?: string[];
/** The number of months the Telegram Premium subscription won from the giveaway will be active for */
premium_subscription_month_count?: number;
}
/** This object represents a message about the completion of a giveaway with public winners. */
export interface GiveawayWinners {
/** The chat that created the giveaway */
chat: Chat;
/** Identifier of the messsage with the giveaway in the chat */
giveaway_message_id: number;
/** Point in time (Unix timestamp) when winners of the giveaway were selected */
winners_selection_date: number;
/** Total number of winners in the giveaway */
winner_count: number;
/** List of up to 100 winners of the giveaway */
winners: User[];
/** The number of other chats the user had to join in order to be eligible for the giveaway */
additional_chat_count?: number;
/** The number of months the Telegram Premium subscription won from the giveaway will be active for */
premium_subscription_month_count?: number;
/** Number of undistributed prizes */
unclaimed_prize_count?: number;
/** True, if only users who had joined the chats after the giveaway started were eligible to win */
only_new_members?: true;
/** True, if the giveaway was canceled because the payment for it was refunded */
was_refunded?: true;
/** Description of additional giveaway prize */
prize_description?: string;
}
/** This object represents a service message about the completion of a giveaway without public winners. */
export interface GiveawayCompleted {
/** Number of winners in the giveaway */
winner_count: number;
/** Number of undistributed prizes */
unclaimed_prize_count?: number;
/** Message with the giveaway that was completed, if it wasn't deleted */
giveaway_message?: Message;
}
/** Describes the options used for link preview generation. */
export interface LinkPreviewOptions {
/** True, if the link preview is disabled */
is_disabled?: boolean;
/** URL to use for the link preview. If empty, then the first URL found in the message text will be used */
url?: string;
/** True, if the media in the link preview is suppposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */
prefer_small_media?: boolean;
/** True, if the media in the link preview is suppposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */
prefer_large_media?: boolean;
/** True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text */
show_above_text?: boolean;
}
/** Describes data sent from a Web App to the bot. */

@@ -741,0 +1005,0 @@ export interface WebAppData {

{
"name": "@telegraf/types",
"private": false,
"version": "6.9.1",
"version": "7.0.0",
"description": "Type declarations for the Telegram API",

@@ -6,0 +6,0 @@ "main": "index.js",

import type { ChosenInlineResult, InlineQuery } from "./inline.js";
import type { Chat, ChatJoinRequest, ChatMemberUpdated, User } from "./manage.js";
import type { Chat, ChatBoostRemoved, ChatBoostUpdated, ChatJoinRequest, ChatMemberUpdated, MessageReactionCountUpdated, MessageReactionUpdated, User } from "./manage.js";
import type { CallbackQuery } from "./markup.js";

@@ -54,2 +54,10 @@ import type { CommonMessageBundle, Message, Poll, PollAnswer } from "./message.js";

}
interface MessageReactionUpdatedUpdate extends AbstractUpdate {
/** A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify `"message_reaction"` in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots. */
message_reaction: MessageReactionUpdated;
}
interface MessageReactionCountUpdatedUpdate extends AbstractUpdate {
/** Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify `"message_reaction_count"` in the list of allowed_updates to receive these updates. */
message_reaction_count: MessageReactionCountUpdated;
}
interface InlineQueryUpdate extends AbstractUpdate {

@@ -95,2 +103,10 @@ /** New incoming inline query */

}
interface ChatBoostUpdatedUpdate extends AbstractUpdate {
/** A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates. */
chat_boost: ChatBoostUpdated;
}
interface ChatBoostRemovedUpdate extends AbstractUpdate {
/** A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates. */
removed_chat_boost: ChatBoostRemoved;
}
}

@@ -97,0 +113,0 @@ /** This object represents an incoming update.

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc