@gramio/types
Advanced tools
Comparing version 7.1.0 to 7.1.1
/** | ||
* Based on Bot Api v7.1.0 (16.2.2024) | ||
* Generated at 2/16/2024, 12:25:24 PM using {@link https://github.com/gramiojs/types | [types]} and {@link https://ark0f.github.io/tg-bot-api | [schema]} generators | ||
* Based on Bot API v7.1.0 (16.2.2024) | ||
* Generated at 2/17/2024, 4:12:56 PM using {@link https://github.com/gramiojs/types | [types]} and {@link https://ark0f.github.io/tg-bot-api | [schema]} generators | ||
*/ | ||
@@ -8,7 +8,14 @@ import * as Params from "./params" | ||
type CallApi<T, R> = (params: T) => Promise<R> | ||
type CallApiWithoutParams<R> = () => Promise<R> | ||
type CallApiWithOptionalParams<T, R> = (params?: T) => Promise<R> | ||
type CallAPI<T, R> = (params: T) => Promise<R> | ||
type CallAPIWithoutParams<R> = () => Promise<R> | ||
type CallAPIWithOptionalParams<T, R> = (params?: T) => Promise<R> | ||
export interface ApiMethods { | ||
export type APIMethodParams<APIMethod extends keyof APIMethods> = Parameters< | ||
APIMethods[APIMethod] | ||
>[0] | ||
export type APIMethodReturn<APIMethod extends keyof APIMethods> = Awaited< | ||
ReturnType<APIMethods[APIMethod]> | ||
> | ||
export interface APIMethods { | ||
/** | ||
@@ -19,3 +26,3 @@ * Use this method to receive incoming updates using long polling ([wiki](https://en.wikipedia.org/wiki/Push_technology#Long_polling)). Returns an Array of [Update](https://core.telegram.org/bots/api/#update) objects. | ||
*/ | ||
getUpdates: CallApiWithOptionalParams< | ||
getUpdates: CallAPIWithOptionalParams< | ||
Params.GetUpdatesParams, | ||
@@ -31,3 +38,3 @@ Objects.TelegramUpdate[] | ||
*/ | ||
setWebhook: CallApiWithOptionalParams<Params.SetWebhookParams, true> | ||
setWebhook: CallAPI<Params.SetWebhookParams, true> | ||
/** | ||
@@ -38,3 +45,3 @@ * Use this method to remove webhook integration if you decide to switch back to [getUpdates](https://core.telegram.org/bots/api/#getupdates). Returns *True* on success. | ||
*/ | ||
deleteWebhook: CallApiWithOptionalParams<Params.DeleteWebhookParams, true> | ||
deleteWebhook: CallAPIWithOptionalParams<Params.DeleteWebhookParams, true> | ||
/** | ||
@@ -45,3 +52,3 @@ * Use this method to get current webhook status. Requires no parameters. On success, returns a [WebhookInfo](https://core.telegram.org/bots/api/#webhookinfo) object. If the bot is using [getUpdates](https://core.telegram.org/bots/api/#getupdates), will return an object with the *url* field empty. | ||
*/ | ||
getWebhookInfo: CallApiWithoutParams<Objects.TelegramWebhookInfo> | ||
getWebhookInfo: CallAPIWithoutParams<Objects.TelegramWebhookInfo> | ||
/** | ||
@@ -52,3 +59,3 @@ * A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a [User](https://core.telegram.org/bots/api/#user) object. | ||
*/ | ||
getMe: CallApiWithoutParams<Objects.TelegramUser> | ||
getMe: CallAPIWithoutParams<Objects.TelegramUser> | ||
/** | ||
@@ -59,3 +66,3 @@ * Use this method to log out from the cloud Bot API server before launching the bot locally. You **must** log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns *True* on success. Requires no parameters. | ||
*/ | ||
logOut: CallApiWithoutParams<true> | ||
logOut: CallAPIWithoutParams<true> | ||
/** | ||
@@ -66,3 +73,3 @@ * Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns *True* on success. Requires no parameters. | ||
*/ | ||
close: CallApiWithoutParams<true> | ||
close: CallAPIWithoutParams<true> | ||
/** | ||
@@ -73,6 +80,3 @@ * Use this method to send text messages. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. | ||
*/ | ||
sendMessage: CallApiWithOptionalParams< | ||
Params.SendMessageParams, | ||
Objects.TelegramMessage | ||
> | ||
sendMessage: CallAPI<Params.SendMessageParams, Objects.TelegramMessage> | ||
/** | ||
@@ -83,3 +87,3 @@ * Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. | ||
*/ | ||
forwardMessage: CallApiWithOptionalParams< | ||
forwardMessage: CallAPI< | ||
Params.ForwardMessageParams, | ||
@@ -93,3 +97,3 @@ Objects.TelegramMessage | ||
*/ | ||
forwardMessages: CallApiWithOptionalParams< | ||
forwardMessages: CallAPI< | ||
Params.ForwardMessagesParams, | ||
@@ -103,6 +107,3 @@ Objects.TelegramMessageId[] | ||
*/ | ||
copyMessage: CallApiWithOptionalParams< | ||
Params.CopyMessageParams, | ||
Objects.TelegramMessageId | ||
> | ||
copyMessage: CallAPI<Params.CopyMessageParams, Objects.TelegramMessageId> | ||
/** | ||
@@ -113,3 +114,3 @@ * 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, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz [poll](https://core.telegram.org/bots/api/#poll) can be copied only if the value of the field *correct\_option\_id* is known to the bot. The method is analogous to the method [forwardMessages](https://core.telegram.org/bots/api/#forwardmessages), but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of [MessageId](https://core.telegram.org/bots/api/#messageid) of the sent messages is returned. | ||
*/ | ||
copyMessages: CallApiWithOptionalParams< | ||
copyMessages: CallAPI< | ||
Params.CopyMessagesParams, | ||
@@ -123,6 +124,3 @@ Objects.TelegramMessageId[] | ||
*/ | ||
sendPhoto: CallApiWithOptionalParams< | ||
Params.SendPhotoParams, | ||
Objects.TelegramMessage | ||
> | ||
sendPhoto: CallAPI<Params.SendPhotoParams, Objects.TelegramMessage> | ||
/** | ||
@@ -135,6 +133,3 @@ * 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](https://core.telegram.org/bots/api/#message) is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. | ||
*/ | ||
sendAudio: CallApiWithOptionalParams< | ||
Params.SendAudioParams, | ||
Objects.TelegramMessage | ||
> | ||
sendAudio: CallAPI<Params.SendAudioParams, Objects.TelegramMessage> | ||
/** | ||
@@ -145,6 +140,3 @@ * Use this method to send general files. On success, the sent [Message](https://core.telegram.org/bots/api/#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. | ||
*/ | ||
sendDocument: CallApiWithOptionalParams< | ||
Params.SendDocumentParams, | ||
Objects.TelegramMessage | ||
> | ||
sendDocument: CallAPI<Params.SendDocumentParams, Objects.TelegramMessage> | ||
/** | ||
@@ -155,6 +147,3 @@ * Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as [Document](https://core.telegram.org/bots/api/#document)). On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. | ||
*/ | ||
sendVideo: CallApiWithOptionalParams< | ||
Params.SendVideoParams, | ||
Objects.TelegramMessage | ||
> | ||
sendVideo: CallAPI<Params.SendVideoParams, Objects.TelegramMessage> | ||
/** | ||
@@ -165,6 +154,3 @@ * Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. | ||
*/ | ||
sendAnimation: CallApiWithOptionalParams< | ||
Params.SendAnimationParams, | ||
Objects.TelegramMessage | ||
> | ||
sendAnimation: CallAPI<Params.SendAnimationParams, Objects.TelegramMessage> | ||
/** | ||
@@ -175,6 +161,3 @@ * 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 (other formats may be sent as [Audio](https://core.telegram.org/bots/api/#audio) or [Document](https://core.telegram.org/bots/api/#document)). On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. | ||
*/ | ||
sendVoice: CallApiWithOptionalParams< | ||
Params.SendVoiceParams, | ||
Objects.TelegramMessage | ||
> | ||
sendVoice: CallAPI<Params.SendVoiceParams, Objects.TelegramMessage> | ||
/** | ||
@@ -185,6 +168,3 @@ * As of [v.4.0](https://telegram.org/blog/video-messages-and-telescope), Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. | ||
*/ | ||
sendVideoNote: CallApiWithOptionalParams< | ||
Params.SendVideoNoteParams, | ||
Objects.TelegramMessage | ||
> | ||
sendVideoNote: CallAPI<Params.SendVideoNoteParams, Objects.TelegramMessage> | ||
/** | ||
@@ -195,3 +175,3 @@ * 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. On success, an array of [Messages](https://core.telegram.org/bots/api/#message) that were sent is returned. | ||
*/ | ||
sendMediaGroup: CallApiWithOptionalParams< | ||
sendMediaGroup: CallAPI< | ||
Params.SendMediaGroupParams, | ||
@@ -205,6 +185,3 @@ Objects.TelegramMessage[] | ||
*/ | ||
sendLocation: CallApiWithOptionalParams< | ||
Params.SendLocationParams, | ||
Objects.TelegramMessage | ||
> | ||
sendLocation: CallAPI<Params.SendLocationParams, Objects.TelegramMessage> | ||
/** | ||
@@ -215,6 +192,3 @@ * Use this method to send information about a venue. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. | ||
*/ | ||
sendVenue: CallApiWithOptionalParams< | ||
Params.SendVenueParams, | ||
Objects.TelegramMessage | ||
> | ||
sendVenue: CallAPI<Params.SendVenueParams, Objects.TelegramMessage> | ||
/** | ||
@@ -225,6 +199,3 @@ * Use this method to send phone contacts. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. | ||
*/ | ||
sendContact: CallApiWithOptionalParams< | ||
Params.SendContactParams, | ||
Objects.TelegramMessage | ||
> | ||
sendContact: CallAPI<Params.SendContactParams, Objects.TelegramMessage> | ||
/** | ||
@@ -235,6 +206,3 @@ * Use this method to send a native poll. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. | ||
*/ | ||
sendPoll: CallApiWithOptionalParams< | ||
Params.SendPollParams, | ||
Objects.TelegramMessage | ||
> | ||
sendPoll: CallAPI<Params.SendPollParams, Objects.TelegramMessage> | ||
/** | ||
@@ -245,6 +213,3 @@ * Use this method to send an animated emoji that will display a random value. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. | ||
*/ | ||
sendDice: CallApiWithOptionalParams< | ||
Params.SendDiceParams, | ||
Objects.TelegramMessage | ||
> | ||
sendDice: CallAPI<Params.SendDiceParams, Objects.TelegramMessage> | ||
/** | ||
@@ -259,3 +224,3 @@ * 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). Returns *True* on success. | ||
*/ | ||
sendChatAction: CallApiWithOptionalParams<Params.SendChatActionParams, true> | ||
sendChatAction: CallAPI<Params.SendChatActionParams, true> | ||
/** | ||
@@ -266,6 +231,3 @@ * Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Returns *True* on success. | ||
*/ | ||
setMessageReaction: CallApiWithOptionalParams< | ||
Params.SetMessageReactionParams, | ||
true | ||
> | ||
setMessageReaction: CallAPI<Params.SetMessageReactionParams, true> | ||
/** | ||
@@ -276,3 +238,3 @@ * Use this method to get a list of profile pictures for a user. Returns a [UserProfilePhotos](https://core.telegram.org/bots/api/#userprofilephotos) object. | ||
*/ | ||
getUserProfilePhotos: CallApiWithOptionalParams< | ||
getUserProfilePhotos: CallAPI< | ||
Params.GetUserProfilePhotosParams, | ||
@@ -286,3 +248,3 @@ Objects.TelegramUserProfilePhotos | ||
*/ | ||
getFile: CallApi<Params.GetFileParams, Objects.TelegramFile> | ||
getFile: CallAPI<Params.GetFileParams, Objects.TelegramFile> | ||
/** | ||
@@ -293,3 +255,3 @@ * Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless [unbanned](https://core.telegram.org/bots/api/#unbanchatmember) first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns *True* on success. | ||
*/ | ||
banChatMember: CallApiWithOptionalParams<Params.BanChatMemberParams, true> | ||
banChatMember: CallAPI<Params.BanChatMemberParams, true> | ||
/** | ||
@@ -300,6 +262,3 @@ * Use this method to unban a previously banned user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be **removed** from the chat. If you don't want this, use the parameter *only\_if\_banned*. Returns *True* on success. | ||
*/ | ||
unbanChatMember: CallApiWithOptionalParams< | ||
Params.UnbanChatMemberParams, | ||
true | ||
> | ||
unbanChatMember: CallAPI<Params.UnbanChatMemberParams, true> | ||
/** | ||
@@ -310,6 +269,3 @@ * Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass *True* for all permissions to lift restrictions from a user. Returns *True* on success. | ||
*/ | ||
restrictChatMember: CallApiWithOptionalParams< | ||
Params.RestrictChatMemberParams, | ||
true | ||
> | ||
restrictChatMember: CallAPI<Params.RestrictChatMemberParams, true> | ||
/** | ||
@@ -320,6 +276,3 @@ * Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass *False* for all boolean parameters to demote a user. Returns *True* on success. | ||
*/ | ||
promoteChatMember: CallApiWithOptionalParams< | ||
Params.PromoteChatMemberParams, | ||
true | ||
> | ||
promoteChatMember: CallAPI<Params.PromoteChatMemberParams, true> | ||
/** | ||
@@ -330,3 +283,3 @@ * Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns *True* on success. | ||
*/ | ||
setChatAdministratorCustomTitle: CallApi< | ||
setChatAdministratorCustomTitle: CallAPI< | ||
Params.SetChatAdministratorCustomTitleParams, | ||
@@ -340,3 +293,3 @@ true | ||
*/ | ||
banChatSenderChat: CallApi<Params.BanChatSenderChatParams, true> | ||
banChatSenderChat: CallAPI<Params.BanChatSenderChatParams, true> | ||
/** | ||
@@ -347,3 +300,3 @@ * Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns *True* on success. | ||
*/ | ||
unbanChatSenderChat: CallApi<Params.UnbanChatSenderChatParams, true> | ||
unbanChatSenderChat: CallAPI<Params.UnbanChatSenderChatParams, true> | ||
/** | ||
@@ -354,6 +307,3 @@ * Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the *can\_restrict\_members* administrator rights. Returns *True* on success. | ||
*/ | ||
setChatPermissions: CallApiWithOptionalParams< | ||
Params.SetChatPermissionsParams, | ||
true | ||
> | ||
setChatPermissions: CallAPI<Params.SetChatPermissionsParams, true> | ||
/** | ||
@@ -364,3 +314,3 @@ * Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as *String* on success. | ||
*/ | ||
exportChatInviteLink: CallApi<Params.ExportChatInviteLinkParams, string> | ||
exportChatInviteLink: CallAPI<Params.ExportChatInviteLinkParams, string> | ||
/** | ||
@@ -371,3 +321,3 @@ * Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method [revokeChatInviteLink](https://core.telegram.org/bots/api/#revokechatinvitelink). Returns the new invite link as [ChatInviteLink](https://core.telegram.org/bots/api/#chatinvitelink) object. | ||
*/ | ||
createChatInviteLink: CallApiWithOptionalParams< | ||
createChatInviteLink: CallAPI< | ||
Params.CreateChatInviteLinkParams, | ||
@@ -381,3 +331,3 @@ Objects.TelegramChatInviteLink | ||
*/ | ||
editChatInviteLink: CallApiWithOptionalParams< | ||
editChatInviteLink: CallAPI< | ||
Params.EditChatInviteLinkParams, | ||
@@ -391,3 +341,3 @@ Objects.TelegramChatInviteLink | ||
*/ | ||
revokeChatInviteLink: CallApi< | ||
revokeChatInviteLink: CallAPI< | ||
Params.RevokeChatInviteLinkParams, | ||
@@ -401,3 +351,3 @@ Objects.TelegramChatInviteLink | ||
*/ | ||
approveChatJoinRequest: CallApi<Params.ApproveChatJoinRequestParams, true> | ||
approveChatJoinRequest: CallAPI<Params.ApproveChatJoinRequestParams, true> | ||
/** | ||
@@ -408,3 +358,3 @@ * Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the *can\_invite\_users* administrator right. Returns *True* on success. | ||
*/ | ||
declineChatJoinRequest: CallApi<Params.DeclineChatJoinRequestParams, true> | ||
declineChatJoinRequest: CallAPI<Params.DeclineChatJoinRequestParams, true> | ||
/** | ||
@@ -415,3 +365,3 @@ * Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns *True* on success. | ||
*/ | ||
setChatPhoto: CallApi<Params.SetChatPhotoParams, true> | ||
setChatPhoto: CallAPI<Params.SetChatPhotoParams, true> | ||
/** | ||
@@ -422,3 +372,3 @@ * Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns *True* on success. | ||
*/ | ||
deleteChatPhoto: CallApi<Params.DeleteChatPhotoParams, true> | ||
deleteChatPhoto: CallAPI<Params.DeleteChatPhotoParams, true> | ||
/** | ||
@@ -429,3 +379,3 @@ * Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns *True* on success. | ||
*/ | ||
setChatTitle: CallApi<Params.SetChatTitleParams, true> | ||
setChatTitle: CallAPI<Params.SetChatTitleParams, true> | ||
/** | ||
@@ -436,6 +386,3 @@ * Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns *True* on success. | ||
*/ | ||
setChatDescription: CallApiWithOptionalParams< | ||
Params.SetChatDescriptionParams, | ||
true | ||
> | ||
setChatDescription: CallAPI<Params.SetChatDescriptionParams, true> | ||
/** | ||
@@ -446,3 +393,3 @@ * 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' administrator right in a supergroup or 'can\_edit\_messages' administrator right in a channel. Returns *True* on success. | ||
*/ | ||
pinChatMessage: CallApiWithOptionalParams<Params.PinChatMessageParams, true> | ||
pinChatMessage: CallAPI<Params.PinChatMessageParams, true> | ||
/** | ||
@@ -453,6 +400,3 @@ * 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' administrator right in a supergroup or 'can\_edit\_messages' administrator right in a channel. Returns *True* on success. | ||
*/ | ||
unpinChatMessage: CallApiWithOptionalParams< | ||
Params.UnpinChatMessageParams, | ||
true | ||
> | ||
unpinChatMessage: CallAPI<Params.UnpinChatMessageParams, true> | ||
/** | ||
@@ -463,3 +407,3 @@ * 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' administrator right in a supergroup or 'can\_edit\_messages' administrator right in a channel. Returns *True* on success. | ||
*/ | ||
unpinAllChatMessages: CallApi<Params.UnpinAllChatMessagesParams, true> | ||
unpinAllChatMessages: CallAPI<Params.UnpinAllChatMessagesParams, true> | ||
/** | ||
@@ -470,3 +414,3 @@ * Use this method for your bot to leave a group, supergroup or channel. Returns *True* on success. | ||
*/ | ||
leaveChat: CallApi<Params.LeaveChatParams, true> | ||
leaveChat: CallAPI<Params.LeaveChatParams, true> | ||
/** | ||
@@ -477,3 +421,3 @@ * Use this method to get up to date information about the chat. Returns a [Chat](https://core.telegram.org/bots/api/#chat) object on success. | ||
*/ | ||
getChat: CallApi<Params.GetChatParams, Objects.TelegramChat> | ||
getChat: CallAPI<Params.GetChatParams, Objects.TelegramChat> | ||
/** | ||
@@ -484,3 +428,3 @@ * Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of [ChatMember](https://core.telegram.org/bots/api/#chatmember) objects. | ||
*/ | ||
getChatAdministrators: CallApi< | ||
getChatAdministrators: CallAPI< | ||
Params.GetChatAdministratorsParams, | ||
@@ -494,3 +438,3 @@ Objects.TelegramChatMember[] | ||
*/ | ||
getChatMemberCount: CallApi<Params.GetChatMemberCountParams, number> | ||
getChatMemberCount: CallAPI<Params.GetChatMemberCountParams, number> | ||
/** | ||
@@ -501,3 +445,3 @@ * Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a [ChatMember](https://core.telegram.org/bots/api/#chatmember) object on success. | ||
*/ | ||
getChatMember: CallApi< | ||
getChatMember: CallAPI< | ||
Params.GetChatMemberParams, | ||
@@ -511,3 +455,3 @@ Objects.TelegramChatMember | ||
*/ | ||
setChatStickerSet: CallApi<Params.SetChatStickerSetParams, true> | ||
setChatStickerSet: CallAPI<Params.SetChatStickerSetParams, true> | ||
/** | ||
@@ -518,3 +462,3 @@ * Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field *can\_set\_sticker\_set* optionally returned in [getChat](https://core.telegram.org/bots/api/#getchat) requests to check if the bot can use this method. Returns *True* on success. | ||
*/ | ||
deleteChatStickerSet: CallApi<Params.DeleteChatStickerSetParams, true> | ||
deleteChatStickerSet: CallAPI<Params.DeleteChatStickerSetParams, true> | ||
/** | ||
@@ -525,3 +469,3 @@ * Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of [Sticker](https://core.telegram.org/bots/api/#sticker) objects. | ||
*/ | ||
getForumTopicIconStickers: CallApiWithoutParams<Objects.TelegramSticker[]> | ||
getForumTopicIconStickers: CallAPIWithoutParams<Objects.TelegramSticker[]> | ||
/** | ||
@@ -532,3 +476,3 @@ * Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights. Returns information about the created topic as a [ForumTopic](https://core.telegram.org/bots/api/#forumtopic) object. | ||
*/ | ||
createForumTopic: CallApiWithOptionalParams< | ||
createForumTopic: CallAPI< | ||
Params.CreateForumTopicParams, | ||
@@ -542,3 +486,3 @@ Objects.TelegramForumTopic | ||
*/ | ||
editForumTopic: CallApiWithOptionalParams<Params.EditForumTopicParams, true> | ||
editForumTopic: CallAPI<Params.EditForumTopicParams, true> | ||
/** | ||
@@ -549,3 +493,3 @@ * Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights, unless it is the creator of the topic. Returns *True* on success. | ||
*/ | ||
closeForumTopic: CallApi<Params.CloseForumTopicParams, true> | ||
closeForumTopic: CallAPI<Params.CloseForumTopicParams, true> | ||
/** | ||
@@ -556,3 +500,3 @@ * Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights, unless it is the creator of the topic. Returns *True* on success. | ||
*/ | ||
reopenForumTopic: CallApi<Params.ReopenForumTopicParams, true> | ||
reopenForumTopic: CallAPI<Params.ReopenForumTopicParams, true> | ||
/** | ||
@@ -563,3 +507,3 @@ * Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_delete\_messages* administrator rights. Returns *True* on success. | ||
*/ | ||
deleteForumTopic: CallApi<Params.DeleteForumTopicParams, true> | ||
deleteForumTopic: CallAPI<Params.DeleteForumTopicParams, true> | ||
/** | ||
@@ -570,3 +514,3 @@ * Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the *can\_pin\_messages* administrator right in the supergroup. Returns *True* on success. | ||
*/ | ||
unpinAllForumTopicMessages: CallApi< | ||
unpinAllForumTopicMessages: CallAPI< | ||
Params.UnpinAllForumTopicMessagesParams, | ||
@@ -580,3 +524,3 @@ true | ||
*/ | ||
editGeneralForumTopic: CallApi<Params.EditGeneralForumTopicParams, true> | ||
editGeneralForumTopic: CallAPI<Params.EditGeneralForumTopicParams, true> | ||
/** | ||
@@ -587,3 +531,3 @@ * Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights. Returns *True* on success. | ||
*/ | ||
closeGeneralForumTopic: CallApi<Params.CloseGeneralForumTopicParams, true> | ||
closeGeneralForumTopic: CallAPI<Params.CloseGeneralForumTopicParams, true> | ||
/** | ||
@@ -594,3 +538,3 @@ * Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights. The topic will be automatically unhidden if it was hidden. Returns *True* on success. | ||
*/ | ||
reopenGeneralForumTopic: CallApi<Params.ReopenGeneralForumTopicParams, true> | ||
reopenGeneralForumTopic: CallAPI<Params.ReopenGeneralForumTopicParams, true> | ||
/** | ||
@@ -601,3 +545,3 @@ * Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights. The topic will be automatically closed if it was open. Returns *True* on success. | ||
*/ | ||
hideGeneralForumTopic: CallApi<Params.HideGeneralForumTopicParams, true> | ||
hideGeneralForumTopic: CallAPI<Params.HideGeneralForumTopicParams, true> | ||
/** | ||
@@ -608,3 +552,3 @@ * Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can\_manage\_topics* administrator rights. Returns *True* on success. | ||
*/ | ||
unhideGeneralForumTopic: CallApi<Params.UnhideGeneralForumTopicParams, true> | ||
unhideGeneralForumTopic: CallAPI<Params.UnhideGeneralForumTopicParams, true> | ||
/** | ||
@@ -615,3 +559,3 @@ * Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the *can\_pin\_messages* administrator right in the supergroup. Returns *True* on success. | ||
*/ | ||
unpinAllGeneralForumTopicMessages: CallApi< | ||
unpinAllGeneralForumTopicMessages: CallAPI< | ||
Params.UnpinAllGeneralForumTopicMessagesParams, | ||
@@ -627,6 +571,3 @@ true | ||
*/ | ||
answerCallbackQuery: CallApiWithOptionalParams< | ||
Params.AnswerCallbackQueryParams, | ||
true | ||
> | ||
answerCallbackQuery: CallAPI<Params.AnswerCallbackQueryParams, true> | ||
/** | ||
@@ -637,3 +578,3 @@ * Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a [UserChatBoosts](https://core.telegram.org/bots/api/#userchatboosts) object. | ||
*/ | ||
getUserChatBoosts: CallApi< | ||
getUserChatBoosts: CallAPI< | ||
Params.GetUserChatBoostsParams, | ||
@@ -647,3 +588,3 @@ Objects.TelegramUserChatBoosts | ||
*/ | ||
setMyCommands: CallApiWithOptionalParams<Params.SetMyCommandsParams, true> | ||
setMyCommands: CallAPI<Params.SetMyCommandsParams, true> | ||
/** | ||
@@ -654,3 +595,3 @@ * Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, [higher level commands](https://core.telegram.org/bots/api/#determining-list-of-commands) will be shown to affected users. Returns *True* on success. | ||
*/ | ||
deleteMyCommands: CallApiWithOptionalParams< | ||
deleteMyCommands: CallAPIWithOptionalParams< | ||
Params.DeleteMyCommandsParams, | ||
@@ -664,3 +605,3 @@ true | ||
*/ | ||
getMyCommands: CallApiWithOptionalParams< | ||
getMyCommands: CallAPIWithOptionalParams< | ||
Params.GetMyCommandsParams, | ||
@@ -674,3 +615,3 @@ Objects.TelegramBotCommand[] | ||
*/ | ||
setMyName: CallApiWithOptionalParams<Params.SetMyNameParams, true> | ||
setMyName: CallAPIWithOptionalParams<Params.SetMyNameParams, true> | ||
/** | ||
@@ -681,3 +622,3 @@ * Use this method to get the current bot name for the given user language. Returns [BotName](https://core.telegram.org/bots/api/#botname) on success. | ||
*/ | ||
getMyName: CallApiWithOptionalParams< | ||
getMyName: CallAPIWithOptionalParams< | ||
Params.GetMyNameParams, | ||
@@ -691,3 +632,3 @@ Objects.TelegramBotName | ||
*/ | ||
setMyDescription: CallApiWithOptionalParams< | ||
setMyDescription: CallAPIWithOptionalParams< | ||
Params.SetMyDescriptionParams, | ||
@@ -701,3 +642,3 @@ true | ||
*/ | ||
getMyDescription: CallApiWithOptionalParams< | ||
getMyDescription: CallAPIWithOptionalParams< | ||
Params.GetMyDescriptionParams, | ||
@@ -711,3 +652,3 @@ Objects.TelegramBotDescription | ||
*/ | ||
setMyShortDescription: CallApiWithOptionalParams< | ||
setMyShortDescription: CallAPIWithOptionalParams< | ||
Params.SetMyShortDescriptionParams, | ||
@@ -721,3 +662,3 @@ true | ||
*/ | ||
getMyShortDescription: CallApiWithOptionalParams< | ||
getMyShortDescription: CallAPIWithOptionalParams< | ||
Params.GetMyShortDescriptionParams, | ||
@@ -731,3 +672,3 @@ Objects.TelegramBotShortDescription | ||
*/ | ||
setChatMenuButton: CallApiWithOptionalParams< | ||
setChatMenuButton: CallAPIWithOptionalParams< | ||
Params.SetChatMenuButtonParams, | ||
@@ -741,3 +682,3 @@ true | ||
*/ | ||
getChatMenuButton: CallApiWithOptionalParams< | ||
getChatMenuButton: CallAPIWithOptionalParams< | ||
Params.GetChatMenuButtonParams, | ||
@@ -751,3 +692,3 @@ Objects.TelegramMenuButton | ||
*/ | ||
setMyDefaultAdministratorRights: CallApiWithOptionalParams< | ||
setMyDefaultAdministratorRights: CallAPIWithOptionalParams< | ||
Params.SetMyDefaultAdministratorRightsParams, | ||
@@ -761,3 +702,3 @@ true | ||
*/ | ||
getMyDefaultAdministratorRights: CallApiWithOptionalParams< | ||
getMyDefaultAdministratorRights: CallAPIWithOptionalParams< | ||
Params.GetMyDefaultAdministratorRightsParams, | ||
@@ -771,3 +712,3 @@ Objects.TelegramChatAdministratorRights | ||
*/ | ||
editMessageText: CallApiWithOptionalParams< | ||
editMessageText: CallAPI< | ||
Params.EditMessageTextParams, | ||
@@ -781,3 +722,3 @@ Objects.TelegramMessage | true | ||
*/ | ||
editMessageCaption: CallApiWithOptionalParams< | ||
editMessageCaption: CallAPIWithOptionalParams< | ||
Params.EditMessageCaptionParams, | ||
@@ -791,3 +732,3 @@ Objects.TelegramMessage | true | ||
*/ | ||
editMessageMedia: CallApiWithOptionalParams< | ||
editMessageMedia: CallAPI< | ||
Params.EditMessageMediaParams, | ||
@@ -801,3 +742,3 @@ Objects.TelegramMessage | true | ||
*/ | ||
editMessageLiveLocation: CallApiWithOptionalParams< | ||
editMessageLiveLocation: CallAPI< | ||
Params.EditMessageLiveLocationParams, | ||
@@ -811,3 +752,3 @@ Objects.TelegramMessage | true | ||
*/ | ||
stopMessageLiveLocation: CallApiWithOptionalParams< | ||
stopMessageLiveLocation: CallAPIWithOptionalParams< | ||
Params.StopMessageLiveLocationParams, | ||
@@ -821,3 +762,3 @@ Objects.TelegramMessage | true | ||
*/ | ||
editMessageReplyMarkup: CallApiWithOptionalParams< | ||
editMessageReplyMarkup: CallAPIWithOptionalParams< | ||
Params.EditMessageReplyMarkupParams, | ||
@@ -831,6 +772,3 @@ Objects.TelegramMessage | true | ||
*/ | ||
stopPoll: CallApiWithOptionalParams< | ||
Params.StopPollParams, | ||
Objects.TelegramPoll | ||
> | ||
stopPoll: CallAPI<Params.StopPollParams, Objects.TelegramPoll> | ||
/** | ||
@@ -850,3 +788,3 @@ * Use this method to delete a message, including service messages, with the following limitations: | ||
*/ | ||
deleteMessage: CallApi<Params.DeleteMessageParams, true> | ||
deleteMessage: CallAPI<Params.DeleteMessageParams, true> | ||
/** | ||
@@ -857,3 +795,3 @@ * Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns *True* on success. | ||
*/ | ||
deleteMessages: CallApi<Params.DeleteMessagesParams, true> | ||
deleteMessages: CallAPI<Params.DeleteMessagesParams, true> | ||
/** | ||
@@ -864,6 +802,3 @@ * Use this method to send static .WEBP, [animated](https://telegram.org/blog/animated-stickers) .TGS, or [video](https://telegram.org/blog/video-stickers-better-reactions) .WEBM stickers. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. | ||
*/ | ||
sendSticker: CallApiWithOptionalParams< | ||
Params.SendStickerParams, | ||
Objects.TelegramMessage | ||
> | ||
sendSticker: CallAPI<Params.SendStickerParams, Objects.TelegramMessage> | ||
/** | ||
@@ -874,3 +809,3 @@ * Use this method to get a sticker set. On success, a [StickerSet](https://core.telegram.org/bots/api/#stickerset) object is returned. | ||
*/ | ||
getStickerSet: CallApi< | ||
getStickerSet: CallAPI< | ||
Params.GetStickerSetParams, | ||
@@ -884,3 +819,3 @@ Objects.TelegramStickerSet | ||
*/ | ||
getCustomEmojiStickers: CallApi< | ||
getCustomEmojiStickers: CallAPI< | ||
Params.GetCustomEmojiStickersParams, | ||
@@ -894,3 +829,3 @@ Objects.TelegramSticker[] | ||
*/ | ||
uploadStickerFile: CallApi< | ||
uploadStickerFile: CallAPI< | ||
Params.UploadStickerFileParams, | ||
@@ -904,6 +839,3 @@ Objects.TelegramFile | ||
*/ | ||
createNewStickerSet: CallApiWithOptionalParams< | ||
Params.CreateNewStickerSetParams, | ||
true | ||
> | ||
createNewStickerSet: CallAPI<Params.CreateNewStickerSetParams, true> | ||
/** | ||
@@ -914,3 +846,3 @@ * Use this method to add a new sticker to a set created by the bot. The format of the added sticker must match the format of the other stickers in the set. Emoji sticker sets can have up to 200 stickers. Animated and video sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns *True* on success. | ||
*/ | ||
addStickerToSet: CallApi<Params.AddStickerToSetParams, true> | ||
addStickerToSet: CallAPI<Params.AddStickerToSetParams, true> | ||
/** | ||
@@ -921,3 +853,3 @@ * Use this method to move a sticker in a set created by the bot to a specific position. Returns *True* on success. | ||
*/ | ||
setStickerPositionInSet: CallApi<Params.SetStickerPositionInSetParams, true> | ||
setStickerPositionInSet: CallAPI<Params.SetStickerPositionInSetParams, true> | ||
/** | ||
@@ -928,3 +860,3 @@ * Use this method to delete a sticker from a set created by the bot. Returns *True* on success. | ||
*/ | ||
deleteStickerFromSet: CallApi<Params.DeleteStickerFromSetParams, true> | ||
deleteStickerFromSet: CallAPI<Params.DeleteStickerFromSetParams, true> | ||
/** | ||
@@ -935,3 +867,3 @@ * Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns *True* on success. | ||
*/ | ||
setStickerEmojiList: CallApi<Params.SetStickerEmojiListParams, true> | ||
setStickerEmojiList: CallAPI<Params.SetStickerEmojiListParams, true> | ||
/** | ||
@@ -942,6 +874,3 @@ * Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns *True* on success. | ||
*/ | ||
setStickerKeywords: CallApiWithOptionalParams< | ||
Params.SetStickerKeywordsParams, | ||
true | ||
> | ||
setStickerKeywords: CallAPI<Params.SetStickerKeywordsParams, true> | ||
/** | ||
@@ -952,6 +881,3 @@ * Use this method to change the [mask position](https://core.telegram.org/bots/api/#maskposition) of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns *True* on success. | ||
*/ | ||
setStickerMaskPosition: CallApiWithOptionalParams< | ||
Params.SetStickerMaskPositionParams, | ||
true | ||
> | ||
setStickerMaskPosition: CallAPI<Params.SetStickerMaskPositionParams, true> | ||
/** | ||
@@ -962,3 +888,3 @@ * Use this method to set the title of a created sticker set. Returns *True* on success. | ||
*/ | ||
setStickerSetTitle: CallApi<Params.SetStickerSetTitleParams, true> | ||
setStickerSetTitle: CallAPI<Params.SetStickerSetTitleParams, true> | ||
/** | ||
@@ -969,6 +895,3 @@ * Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns *True* on success. | ||
*/ | ||
setStickerSetThumbnail: CallApiWithOptionalParams< | ||
Params.SetStickerSetThumbnailParams, | ||
true | ||
> | ||
setStickerSetThumbnail: CallAPI<Params.SetStickerSetThumbnailParams, true> | ||
/** | ||
@@ -979,3 +902,3 @@ * Use this method to set the thumbnail of a custom emoji sticker set. Returns *True* on success. | ||
*/ | ||
setCustomEmojiStickerSetThumbnail: CallApiWithOptionalParams< | ||
setCustomEmojiStickerSetThumbnail: CallAPI< | ||
Params.SetCustomEmojiStickerSetThumbnailParams, | ||
@@ -989,3 +912,3 @@ true | ||
*/ | ||
deleteStickerSet: CallApi<Params.DeleteStickerSetParams, true> | ||
deleteStickerSet: CallAPI<Params.DeleteStickerSetParams, true> | ||
/** | ||
@@ -997,6 +920,3 @@ * Use this method to send answers to an inline query. On success, *True* is returned. | ||
*/ | ||
answerInlineQuery: CallApiWithOptionalParams< | ||
Params.AnswerInlineQueryParams, | ||
true | ||
> | ||
answerInlineQuery: CallAPI<Params.AnswerInlineQueryParams, true> | ||
/** | ||
@@ -1007,3 +927,3 @@ * Use this method to set the result of an interaction with a [Web App](https://core.telegram.org/bots/webapps) and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a [SentWebAppMessage](https://core.telegram.org/bots/api/#sentwebappmessage) object is returned. | ||
*/ | ||
answerWebAppQuery: CallApi< | ||
answerWebAppQuery: CallAPI< | ||
Params.AnswerWebAppQueryParams, | ||
@@ -1017,6 +937,3 @@ Objects.TelegramSentWebAppMessage | ||
*/ | ||
sendInvoice: CallApiWithOptionalParams< | ||
Params.SendInvoiceParams, | ||
Objects.TelegramMessage | ||
> | ||
sendInvoice: CallAPI<Params.SendInvoiceParams, Objects.TelegramMessage> | ||
/** | ||
@@ -1027,6 +944,3 @@ * Use this method to create a link for an invoice. Returns the created invoice link as *String* on success. | ||
*/ | ||
createInvoiceLink: CallApiWithOptionalParams< | ||
Params.CreateInvoiceLinkParams, | ||
string | ||
> | ||
createInvoiceLink: CallAPI<Params.CreateInvoiceLinkParams, string> | ||
/** | ||
@@ -1037,6 +951,3 @@ * If you sent an invoice requesting a shipping address and the parameter *is\_flexible* was specified, the Bot API will send an [Update](https://core.telegram.org/bots/api/#update) with a *shipping\_query* field to the bot. Use this method to reply to shipping queries. On success, *True* is returned. | ||
*/ | ||
answerShippingQuery: CallApiWithOptionalParams< | ||
Params.AnswerShippingQueryParams, | ||
true | ||
> | ||
answerShippingQuery: CallAPI<Params.AnswerShippingQueryParams, true> | ||
/** | ||
@@ -1047,6 +958,3 @@ * Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an [Update](https://core.telegram.org/bots/api/#update) with the field *pre\_checkout\_query*. Use this method to respond to such pre-checkout queries. On success, *True* is returned. **Note:** The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent. | ||
*/ | ||
answerPreCheckoutQuery: CallApiWithOptionalParams< | ||
Params.AnswerPreCheckoutQueryParams, | ||
true | ||
> | ||
answerPreCheckoutQuery: CallAPI<Params.AnswerPreCheckoutQueryParams, true> | ||
/** | ||
@@ -1059,3 +967,3 @@ * Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns *True* on success. | ||
*/ | ||
setPassportDataErrors: CallApi<Params.SetPassportDataErrorsParams, true> | ||
setPassportDataErrors: CallAPI<Params.SetPassportDataErrorsParams, true> | ||
/** | ||
@@ -1066,6 +974,3 @@ * Use this method to send a game. On success, the sent [Message](https://core.telegram.org/bots/api/#message) is returned. | ||
*/ | ||
sendGame: CallApiWithOptionalParams< | ||
Params.SendGameParams, | ||
Objects.TelegramMessage | ||
> | ||
sendGame: CallAPI<Params.SendGameParams, Objects.TelegramMessage> | ||
/** | ||
@@ -1076,3 +981,3 @@ * Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the [Message](https://core.telegram.org/bots/api/#message) is returned, otherwise *True* is returned. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is *False*. | ||
*/ | ||
setGameScore: CallApiWithOptionalParams< | ||
setGameScore: CallAPI< | ||
Params.SetGameScoreParams, | ||
@@ -1088,3 +993,3 @@ Objects.TelegramMessage | true | ||
*/ | ||
getGameHighScores: CallApiWithOptionalParams< | ||
getGameHighScores: CallAPI< | ||
Params.GetGameHighScoresParams, | ||
@@ -1091,0 +996,0 @@ Objects.TelegramGameHighScore[] |
{ | ||
"name": "@gramio/types", | ||
"version": "7.1.0", | ||
"version": "7.1.1", | ||
"homepage": "https://github.com/gramiojs/types", | ||
@@ -5,0 +5,0 @@ "readme": "https://github.com/gramiojs/types", |
@@ -5,3 +5,3 @@ # Code-generated and Auto-published Telegram Bot API types | ||
7.0.x types - for 7.0 Telegram Bot API | ||
7.1.x types is for 7.1 Telegram Bot API | ||
@@ -11,6 +11,9 @@ ## Usage as an [NPM package](https://www.npmjs.com/package/@gramio/types) | ||
```ts | ||
import type { ApiMethods } from "@gramio/types"; | ||
import type { APIMethods, APIMethodReturn } from "@gramio/types"; | ||
type SendMessageReturn = ReturnType<ApiMethods["sendMessage"]>; | ||
// ^? type SendMessageReturn = Promise<TelegramMessage> | ||
type SendMessageReturn = Awaited<ReturnType<APIMethods["sendMessage"]>>; | ||
// ^? type SendMessageReturn = TelegramMessage | ||
type GetMeReturn = APIMethodReturn<"getMe">; | ||
// ^? type SendMessageReturn = TelegramUser | ||
``` | ||
@@ -22,3 +25,3 @@ | ||
This library is updated automatically to the latest version of the Telegram Bot Api in case of changes thanks to CI CD! | ||
This library is updated automatically to the latest version of the Telegram Bot API in case of changes thanks to CI CD! | ||
If the github action failed, there are no changes in the bot api | ||
@@ -29,3 +32,3 @@ | ||
- `index` - exports everything in the section | ||
- `methods` - exports `ApiMethods` which describes the api functions | ||
- `methods` - exports `APIMethods` which describes the api functions | ||
- `objects` - exports objects with the `Telegram` prefix (for example [Update](https://core.telegram.org/bots/api/#update)) | ||
@@ -37,3 +40,7 @@ - `params` - exports params that are used in `methods` | ||
```typescript | ||
import type { ApiMethods, TelegramAPIResponse } from "@gramio/types"; | ||
import type { | ||
APIMethods, | ||
APIMethodParams, | ||
TelegramAPIResponse, | ||
} from "@gramio/types"; | ||
@@ -43,6 +50,6 @@ const TBA_BASE_URL = "https://api.telegram.org/bot"; | ||
const api = new Proxy({} as ApiMethods, { | ||
const api = new Proxy({} as APIMethods, { | ||
get: | ||
<T extends keyof ApiMethods>(_target: ApiMethods, method: T) => | ||
async (params: Parameters<ApiMethods[T]>[0]) => { | ||
<T extends keyof APIMethods>(_target: APIMethods, method: T) => | ||
async (params: APIMethodParams<T>) => { | ||
const response = await fetch(`${TBA_BASE_URL}${TOKEN}/${method}`, { | ||
@@ -49,0 +56,0 @@ method: "POST", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
123
388375
9328