@grammyjs/types
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -1,2 +0,1 @@ | ||
import { Close } from "./close"; | ||
import { User } from "./manage"; | ||
@@ -62,31 +61,21 @@ import { Message } from "./message"; | ||
export namespace CallbackQuery { | ||
interface AbstractCallbackQuery { | ||
/** Unique identifier for this query */ | ||
id: string; | ||
/** Sender */ | ||
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; | ||
/** Identifier of the message sent via the bot in inline mode, that originated the query. */ | ||
inline_message_id?: string; | ||
/** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */ | ||
chat_instance: string; | ||
} | ||
export interface DataCallbackQuery extends AbstractCallbackQuery { | ||
/** Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field. */ | ||
data: string; | ||
} | ||
export interface GameShortGameCallbackQuery extends AbstractCallbackQuery { | ||
/** Short name of a Game to be returned, serves as the unique identifier for the game */ | ||
game_short_name: string; | ||
} | ||
} | ||
/** This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present. | ||
NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). */ | ||
export type CallbackQuery = Close< | ||
CallbackQuery.DataCallbackQuery | CallbackQuery.GameShortGameCallbackQuery | ||
>; | ||
NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). */ | ||
export interface CallbackQuery { | ||
/** Unique identifier for this query */ | ||
id: string; | ||
/** Sender */ | ||
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; | ||
/** Identifier of the message sent via the bot in inline mode, that originated the query. */ | ||
inline_message_id?: string; | ||
/** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */ | ||
chat_instance: string; | ||
/** Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field. */ | ||
data?: string; | ||
/** Short name of a Game to be returned, serves as the unique identifier for the game */ | ||
game_short_name?: string; | ||
} | ||
@@ -93,0 +82,0 @@ /** Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. |
@@ -1,2 +0,1 @@ | ||
import { Close } from "./close"; | ||
import { Location, Message, PhotoSize } from "./message"; | ||
@@ -155,13 +154,14 @@ import { Update } from "./update"; | ||
/** This object represents a chat. */ | ||
export type Chat = Close< | ||
Chat.PrivateChat | Chat.GroupChat | Chat.SupergroupChat | Chat.ChannelChat | ||
>; | ||
export type Chat = | ||
| Chat.PrivateChat | ||
| Chat.GroupChat | ||
| Chat.SupergroupChat | ||
| Chat.ChannelChat; | ||
/** This object represents a Telegram user or bot that was returned by `getChat`. */ | ||
export type ChatFromGetChat = Close< | ||
export type ChatFromGetChat = | ||
| Chat.PrivateGetChat | ||
| Chat.GroupGetChat | ||
| Chat.SupergroupGetChat | ||
| Chat.ChannelGetChat | ||
>; | ||
| Chat.ChannelGetChat; | ||
@@ -168,0 +168,0 @@ /** This object represent a user's profile pictures. */ |
390
message.d.ts
@@ -1,2 +0,1 @@ | ||
import { Close } from "./close"; | ||
import { InlineKeyboardMarkup } from "./inline"; | ||
@@ -7,242 +6,116 @@ import { Chat, User } from "./manage"; | ||
export namespace Message { | ||
interface ServiceMessage { | ||
/** Unique message identifier inside this chat */ | ||
message_id: number; | ||
/** Sender, empty for messages sent to channels */ | ||
from?: User; | ||
/** Sender of the message, sent on behalf of a chat. The channel itself for channel messages. The supergroup itself for messages from anonymous group administrators. The linked channel for messages automatically forwarded to the discussion group */ | ||
sender_chat?: Chat; | ||
/** Date the message was sent in Unix time */ | ||
date: number; | ||
/** Conversation the message belongs to */ | ||
chat: Chat; | ||
} | ||
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 messages forwarded from channels, signature of the post author 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; | ||
/** 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. */ | ||
reply_to_message?: ReplyMessage; | ||
/** Bot through which the message was sent */ | ||
via_bot?: User; | ||
/** Date the message was last edited in Unix time */ | ||
edit_date?: number; | ||
/** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */ | ||
author_signature?: string; | ||
/** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */ | ||
reply_markup?: InlineKeyboardMarkup; | ||
} | ||
export interface TextMessage extends CommonMessage { | ||
/** For text messages, the actual UTF-8 text of the message, 0-4096 characters */ | ||
text: string; | ||
/** For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */ | ||
entities?: MessageEntity[]; | ||
} | ||
export interface CaptionableMessage extends CommonMessage { | ||
/** Caption for the animation, audio, document, photo, video or voice, 0-1024 characters */ | ||
caption?: string; | ||
/** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */ | ||
caption_entities?: MessageEntity[]; | ||
} | ||
interface MediaMessage extends CaptionableMessage { | ||
/** The unique identifier of a media message group this message belongs to */ | ||
media_group_id?: string; | ||
} | ||
export interface AudioMessage extends CaptionableMessage { | ||
/** Message is an audio file, information about the file */ | ||
audio: Audio; | ||
} | ||
export interface DocumentMessage extends CaptionableMessage { | ||
/** Message is a general file, information about the file */ | ||
document: Document; | ||
} | ||
export interface AnimationMessage extends DocumentMessage { | ||
/** Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set */ | ||
animation: Animation; | ||
} | ||
export interface PhotoMessage extends MediaMessage { | ||
/** Message is a photo, available sizes of the photo */ | ||
photo: PhotoSize[]; | ||
} | ||
export interface StickerMessage extends CommonMessage { | ||
/** Message is a sticker, information about the sticker */ | ||
sticker: Sticker; | ||
} | ||
export interface VideoMessage extends MediaMessage { | ||
/** Message is a video, information about the video */ | ||
video: Video; | ||
} | ||
export interface VideoNoteMessage extends CommonMessage { | ||
/** Message is a video note, information about the video message */ | ||
video_note: VideoNote; | ||
} | ||
export interface VoiceMessage extends CaptionableMessage { | ||
/** Message is a voice message, information about the file */ | ||
voice: Voice; | ||
} | ||
export interface ContactMessage extends CommonMessage { | ||
/** Message is a shared contact, information about the contact */ | ||
contact: Contact; | ||
} | ||
export interface DiceMessage extends CommonMessage { | ||
/** Message is a dice with random value */ | ||
dice: Dice; | ||
} | ||
export interface GameMessage extends CommonMessage { | ||
/** Message is a game, information about the game. More about games » */ | ||
game: Game; | ||
} | ||
export interface PollMessage extends CommonMessage { | ||
/** Message is a native poll, information about the poll */ | ||
poll: Poll; | ||
} | ||
export interface LocationMessage extends CommonMessage { | ||
/** Message is a shared location, information about the location */ | ||
location: Location; | ||
} | ||
export interface VenueMessage extends LocationMessage { | ||
/** Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */ | ||
venue: Venue; | ||
} | ||
export interface NewChatMembersMessage extends ServiceMessage { | ||
/** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */ | ||
new_chat_members: User[]; | ||
} | ||
export interface LeftChatMemberMessage extends ServiceMessage { | ||
/** A member was removed from the group, information about them (this member may be the bot itself) */ | ||
left_chat_member: User; | ||
} | ||
export interface NewChatTitleMessage extends ServiceMessage { | ||
/** A chat title was changed to this value */ | ||
new_chat_title: string; | ||
} | ||
export interface NewChatPhotoMessage extends ServiceMessage { | ||
/** A chat photo was change to this value */ | ||
new_chat_photo: PhotoSize[]; | ||
} | ||
export interface DeleteChatPhotoMessage extends ServiceMessage { | ||
/** Service message: the chat photo was deleted */ | ||
delete_chat_photo: true; | ||
} | ||
export interface GroupChatCreatedMessage extends ServiceMessage { | ||
/** Service message: the group has been created */ | ||
group_chat_created: true; | ||
} | ||
export interface SupergroupChatCreated extends ServiceMessage { | ||
/** Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */ | ||
supergroup_chat_created: true; | ||
} | ||
export interface ChannelChatCreatedMessage extends ServiceMessage { | ||
/** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */ | ||
channel_chat_created: true; | ||
} | ||
export interface MessageAutoDeleteTimerChangedMessage extends ServiceMessage { | ||
/** Service message: auto-delete timer settings changed in the chat */ | ||
message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged; | ||
} | ||
export 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. */ | ||
migrate_to_chat_id: number; | ||
} | ||
export 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. */ | ||
migrate_from_chat_id: number; | ||
} | ||
export interface PinnedMessageMessage extends ServiceMessage { | ||
/** 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; | ||
} | ||
export interface InvoiceMessage extends ServiceMessage { | ||
/** Message is an invoice for a payment, information about the invoice. More about payments » */ | ||
invoice: Invoice; | ||
} | ||
export interface SuccessfulPaymentMessage extends ServiceMessage { | ||
/** Message is a service message about a successful payment, information about the payment. More about payments » */ | ||
successful_payment: SuccessfulPayment; | ||
} | ||
export interface ConnectedWebsiteMessage extends ServiceMessage { | ||
/** The domain name of the website on which the user has logged in. More about Telegram Login » */ | ||
connected_website: string; | ||
} | ||
export interface PassportDataMessage extends ServiceMessage { | ||
/** Telegram Passport data */ | ||
passport_data: PassportData; | ||
} | ||
export interface ProximityAlertTriggeredMessage extends ServiceMessage { | ||
/** Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */ | ||
proximity_alert_triggered: ProximityAlertTriggered; | ||
} | ||
export interface VoiceChatStartedMessage extends ServiceMessage { | ||
/** Service message: voice chat started */ | ||
voice_chat_started: VoiceChatStarted; | ||
} | ||
export interface VoiceChatEndedMessage extends ServiceMessage { | ||
/** Service message: voice chat ended */ | ||
voice_chat_ended: VoiceChatEnded; | ||
} | ||
export interface VoiceChatParticipantsInvitedMessage extends ServiceMessage { | ||
/** Service message: new participants invited to a voice chat */ | ||
voice_chat_participants_invited: VoiceChatParticipantsInvited; | ||
} | ||
/** This object represents a message. */ | ||
export interface Message { | ||
/** Unique message identifier inside this chat */ | ||
message_id: number; | ||
/** Sender, empty for messages sent to channels */ | ||
from?: User; | ||
/** Sender of the message, sent on behalf of a chat. The channel itself for channel messages. The supergroup itself for messages from anonymous group administrators. The linked channel for messages automatically forwarded to the discussion group */ | ||
sender_chat?: Chat; | ||
/** Date the message was sent in Unix time */ | ||
date: number; | ||
/** Conversation the message belongs to */ | ||
chat: Chat; | ||
/** 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 messages forwarded from channels, signature of the post author 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; | ||
/** 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. */ | ||
reply_to_message?: Message; | ||
/** Bot through which the message was sent */ | ||
via_bot?: User; | ||
/** Date the message was last edited in Unix time */ | ||
edit_date?: number; | ||
/** The unique identifier of a media message group this message belongs to */ | ||
media_group_id?: string; | ||
/** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */ | ||
author_signature?: string; | ||
/** For text messages, the actual UTF-8 text of the message, 0-4096 characters */ | ||
text?: string; | ||
/** For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */ | ||
entities?: MessageEntity[]; | ||
/** Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set */ | ||
animation?: Animation; | ||
/** Message is an audio file, information about the file */ | ||
audio?: Audio; | ||
/** Message is a general file, information about the file */ | ||
document?: Document; | ||
/** Message is a photo, available sizes of the photo */ | ||
photo?: PhotoSize[]; | ||
/** Message is a sticker, information about the sticker */ | ||
sticker?: Sticker; | ||
/** Message is a video, information about the video */ | ||
video?: Video; | ||
/** Message is a video note, information about the video message */ | ||
video_note?: VideoNote; | ||
/** Message is a voice message, information about the file */ | ||
voice?: Voice; | ||
/** Caption for the animation, audio, document, photo, video or voice, 0-1024 characters */ | ||
caption?: string; | ||
/** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */ | ||
caption_entities?: MessageEntity[]; | ||
/** Message is a shared contact, information about the contact */ | ||
contact?: Contact; | ||
/** Message is a dice with random value */ | ||
dice?: Dice; | ||
/** Message is a game, information about the game. More about games » */ | ||
game?: Game; | ||
/** Message is a native poll, information about the poll */ | ||
poll?: Poll; | ||
/** Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */ | ||
venue?: Venue; | ||
/** Message is a shared location, information about the location */ | ||
location?: Location; | ||
/** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */ | ||
new_chat_members?: User[]; | ||
/** A member was removed from the group, information about them (this member may be the bot itself) */ | ||
left_chat_member?: User; | ||
/** A chat title was changed to this value */ | ||
new_chat_title?: string; | ||
/** A chat photo was change to this value */ | ||
new_chat_photo?: PhotoSize[]; | ||
/** Service message: the chat photo was deleted */ | ||
delete_chat_photo?: true; | ||
/** Service message: the group has been created */ | ||
group_chat_created?: true; | ||
/** Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */ | ||
supergroup_chat_created?: true; | ||
/** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */ | ||
channel_chat_created?: true; | ||
/** Service message: auto-delete timer settings changed in the chat */ | ||
message_auto_delete_timer_changed?: MessageAutoDeleteTimerChanged; | ||
/** 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. */ | ||
migrate_to_chat_id?: number; | ||
/** 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. */ | ||
migrate_from_chat_id?: number; | ||
/** 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?: Message; | ||
/** Message is an invoice for a payment, information about the invoice. More about payments » */ | ||
invoice?: Invoice; | ||
/** Message is a service message about a successful payment, information about the payment. More about payments » */ | ||
successful_payment?: SuccessfulPayment; | ||
/** The domain name of the website on which the user has logged in. More about Telegram Login » */ | ||
connected_website?: string; | ||
/** Telegram Passport data */ | ||
passport_data?: PassportData; | ||
/** Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */ | ||
proximity_alert_triggered?: ProximityAlertTriggered; | ||
/** Service message: voice chat started */ | ||
voice_chat_started?: VoiceChatStarted; | ||
/** Service message: voice chat ended */ | ||
voice_chat_ended?: VoiceChatEnded; | ||
/** Service message: new participants invited to a voice chat */ | ||
voice_chat_participants_invited?: VoiceChatParticipantsInvited; | ||
/** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */ | ||
reply_markup?: InlineKeyboardMarkup; | ||
} | ||
/** 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`. */ | ||
type ServiceMessageBundle = | ||
| Message.ChannelChatCreatedMessage | ||
| Message.ConnectedWebsiteMessage | ||
| Message.DeleteChatPhotoMessage | ||
| Message.GroupChatCreatedMessage | ||
| Message.InvoiceMessage | ||
| Message.LeftChatMemberMessage | ||
| Message.MessageAutoDeleteTimerChangedMessage | ||
| Message.MigrateFromChatIdMessage | ||
| Message.MigrateToChatIdMessage | ||
| Message.NewChatMembersMessage | ||
| Message.NewChatPhotoMessage | ||
| Message.NewChatTitleMessage | ||
| Message.PassportDataMessage | ||
| Message.PinnedMessageMessage | ||
| Message.ProximityAlertTriggeredMessage | ||
| Message.SuccessfulPaymentMessage | ||
| Message.SupergroupChatCreated | ||
| Message.VoiceChatStartedMessage | ||
| Message.VoiceChatEndedMessage | ||
| Message.VoiceChatParticipantsInvitedMessage; | ||
/** 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`. */ | ||
type CommonMessageBundle = | ||
| Message.AnimationMessage | ||
| Message.AudioMessage | ||
| Message.ContactMessage | ||
| Message.DiceMessage | ||
| Message.DocumentMessage | ||
| Message.GameMessage | ||
| Message.LocationMessage | ||
| Message.PhotoMessage | ||
| Message.PollMessage | ||
| Message.StickerMessage | ||
| Message.TextMessage | ||
| Message.VenueMessage | ||
| Message.VideoMessage | ||
| Message.VideoNoteMessage | ||
| Message.VoiceMessage; | ||
/** Helper type that represents a message which occurs in a `reply_to_message` field. */ | ||
type ReplyMessage = | ||
| ServiceMessageBundle | ||
| (CommonMessageBundle & { reply_to_message: undefined }); | ||
/** This object represents a message. */ | ||
export type Message = Close<ServiceMessageBundle | CommonMessageBundle>; | ||
/** This object represents a unique message identifier. */ | ||
@@ -385,8 +258,7 @@ export interface MessageId { | ||
/** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */ | ||
export type MessageEntity = Close< | ||
export type MessageEntity = | ||
| MessageEntity.CommonMessageEntity | ||
| MessageEntity.PreMessageEntity | ||
| MessageEntity.TextLinkMessageEntity | ||
| MessageEntity.TextMentionMessageEntity | ||
>; | ||
| MessageEntity.TextMentionMessageEntity; | ||
@@ -589,24 +461,18 @@ /** This object represents one size of a photo or a file / sticker thumbnail. */ | ||
export namespace Location { | ||
export interface CommonLocation { | ||
/** Longitude as defined by sender */ | ||
longitude: number; | ||
/** Latitude as defined by sender */ | ||
latitude: number; | ||
/** The radius of uncertainty for the location, measured in meters; 0-1500 */ | ||
horizontal_accuracy?: number; | ||
} | ||
export interface LiveLocation extends CommonLocation { | ||
/** Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only. */ | ||
live_period: number; | ||
/** The direction in which user is moving, in degrees; 1-360. For active live locations only. */ | ||
heading: number; | ||
/** Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */ | ||
proximity_alert_radius?: number; | ||
} | ||
/** This object represents a point on the map. */ | ||
export interface Location { | ||
/** Longitude as defined by sender */ | ||
longitude: number; | ||
/** Latitude as defined by sender */ | ||
latitude: number; | ||
/** Optional. The radius of uncertainty for the location, measured in meters; 0-1500 */ | ||
horizontal_accuracy: number; | ||
/** Time relative to the message sending date, during which the location can be updated, in seconds. For active live locations only. */ | ||
live_period?: number; | ||
/** The direction in which user is moving, in degrees; 1-360. For active live locations only. */ | ||
heading?: number; | ||
/** Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */ | ||
proximity_alert_radius?: number; | ||
} | ||
/** This object represents a point on the map. */ | ||
export type Location = Close<Location.CommonLocation | Location.LiveLocation>; | ||
/** This object represents a venue. */ | ||
@@ -613,0 +479,0 @@ export interface Venue { |
{ | ||
"name": "@grammyjs/types", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "Telegram Bot API type declarations for grammY", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
135
update.d.ts
import { CallbackQuery } from "./callback"; | ||
import { Close } from "./close"; | ||
import { ChosenInlineResult, InlineQuery } from "./inline"; | ||
import { Chat, ChatMemberUpdated, User } from "./manage"; | ||
import { ChatMemberUpdated } from "./manage"; | ||
import { Message, Poll, PollAnswer } from "./message"; | ||
import { PreCheckoutQuery, ShippingQuery } from "./payment"; | ||
export namespace Update { | ||
/** Internal type holding properties that updates in channels share. */ | ||
export interface Channel { | ||
chat: Chat.ChannelChat; | ||
author_signature?: string; | ||
from?: never; | ||
} | ||
/** Internal type holding properties that updates outside of channels share. */ | ||
export interface NonChannel { | ||
chat: Exclude<Chat, Chat.ChannelChat>; | ||
author_signature?: never; | ||
from: User; | ||
} | ||
/** Internal type holding properties that updates about new messages share. */ | ||
export interface New { | ||
edit_date?: never; | ||
} | ||
/** Internal type holding properties that updates about edited messages share. */ | ||
export interface Edited { | ||
/** Date the message was last edited in Unix time */ | ||
edit_date: number; | ||
forward_from?: never; | ||
forward_from_chat?: never; | ||
forward_from_message_id?: never; | ||
forward_signature?: never; | ||
forward_sender_name?: never; | ||
forward_date?: never; | ||
} | ||
export interface AbstractUpdate { | ||
/** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */ | ||
update_id: number; | ||
} | ||
export interface MessageUpdate extends AbstractUpdate { | ||
/** New incoming message of any kind — text, photo, sticker, etc. */ | ||
message: Message & New & NonChannel; | ||
} | ||
export interface EditedMessageUpdate extends AbstractUpdate { | ||
/** New version of a message that is known to the bot and was edited */ | ||
edited_message: Message & Edited & NonChannel; | ||
} | ||
export interface ChannelPostUpdate extends AbstractUpdate { | ||
/** New incoming channel post of any kind — text, photo, sticker, etc. */ | ||
channel_post: Message & New & Channel; | ||
} | ||
export interface EditedChannelPostUpdate extends AbstractUpdate { | ||
/** New version of a channel post that is known to the bot and was edited */ | ||
edited_channel_post: Message & Edited & Channel; | ||
} | ||
export interface InlineQueryUpdate extends AbstractUpdate { | ||
/** New incoming inline query */ | ||
inline_query: InlineQuery; | ||
} | ||
export interface ChosenInlineResultUpdate extends AbstractUpdate { | ||
/** The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */ | ||
chosen_inline_result: ChosenInlineResult; | ||
} | ||
export interface CallbackQueryUpdate extends AbstractUpdate { | ||
/** New incoming callback query */ | ||
callback_query: CallbackQuery; | ||
} | ||
export interface ShippingQueryUpdate extends AbstractUpdate { | ||
/** New incoming shipping query. Only for invoices with flexible price */ | ||
shipping_query: ShippingQuery; | ||
} | ||
export interface PreCheckoutQueryUpdate extends AbstractUpdate { | ||
/** New incoming pre-checkout query. Contains full information about checkout */ | ||
pre_checkout_query: PreCheckoutQuery; | ||
} | ||
export interface PollUpdate extends AbstractUpdate { | ||
/** New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot */ | ||
poll: Poll; | ||
} | ||
export interface PollAnswerUpdate extends AbstractUpdate { | ||
/** A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. */ | ||
poll_answer: PollAnswer; | ||
} | ||
export interface MyChatMemberUpdate extends AbstractUpdate { | ||
/** The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. */ | ||
my_chat_member: ChatMemberUpdated; | ||
} | ||
export interface ChatMemberUpdate extends AbstractUpdate { | ||
/** A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. */ | ||
chat_member: ChatMemberUpdated; | ||
} | ||
/** This object represents an incoming update. | ||
At most one of the optional parameters can be present in any given update. */ | ||
export interface Update { | ||
/** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */ | ||
update_id: number; | ||
/** New incoming message of any kind — text, photo, sticker, etc. */ | ||
message?: Message; | ||
/** New version of a message that is known to the bot and was edited */ | ||
edited_message?: Message; | ||
/** New incoming channel post of any kind — text, photo, sticker, etc. */ | ||
channel_post?: Message; | ||
/** New version of a channel post that is known to the bot and was edited */ | ||
edited_channel_post?: Message; | ||
/** New incoming inline query */ | ||
inline_query?: InlineQuery; | ||
/** The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */ | ||
chosen_inline_result?: ChosenInlineResult; | ||
/** New incoming callback query */ | ||
callback_query?: CallbackQuery; | ||
/** New incoming shipping query. Only for invoices with flexible price */ | ||
shipping_query?: ShippingQuery; | ||
/** New incoming pre-checkout query. Contains full information about checkout */ | ||
pre_checkout_query?: PreCheckoutQuery; | ||
/** New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot */ | ||
poll?: Poll; | ||
/** A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. */ | ||
poll_answer?: PollAnswer; | ||
/** The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. */ | ||
my_chat_member?: ChatMemberUpdated; | ||
/** A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. */ | ||
chat_member?: ChatMemberUpdated; | ||
} | ||
export type Update = Close< | ||
| Update.CallbackQueryUpdate | ||
| Update.ChannelPostUpdate | ||
| Update.ChatMemberUpdate | ||
| Update.ChosenInlineResultUpdate | ||
| Update.EditedChannelPostUpdate | ||
| Update.EditedMessageUpdate | ||
| Update.InlineQueryUpdate | ||
| Update.MessageUpdate | ||
| Update.MyChatMemberUpdate | ||
| Update.PreCheckoutQueryUpdate | ||
| Update.PollAnswerUpdate | ||
| Update.PollUpdate | ||
| Update.ShippingQueryUpdate | ||
>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206717
15
3345