Skip to content

Commit 4520983

Browse files
committed
feat: add support for Bot API v9.5
1 parent debadb9 commit 4520983

4 files changed

Lines changed: 47 additions & 16 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# effect-tg
22

33
[![Effectful](https://img.shields.io/badge/Yes.-%23fff?style=flat&logo=effect&logoColor=%23000&logoSize=auto&label=Effect%3F&labelColor=%23fff&color=%23000)](https://effect.website/)
4-
[![Bot API](https://img.shields.io/badge/v9.4-%23fff?style=flat&logo=telegram&logoColor=%2325A3E1&logoSize=auto&label=Bot%20API&labelColor=%23fff&color=%2325A3E1)](https://core.telegram.org/bots/api)
4+
[![Bot API](https://img.shields.io/badge/v9.5-%23fff?style=flat&logo=telegram&logoColor=%2325A3E1&logoSize=auto&label=Bot%20API&labelColor=%23fff&color=%2325A3E1)](https://core.telegram.org/bots/api)
55
[![npm](https://img.shields.io/npm/v/%40grom.js%2Feffect-tg?style=flat&logo=npm&logoColor=%23BB443E&logoSize=auto&label=Latest&labelColor=%23fff&color=%23BB443E)](https://www.npmjs.com/package/@grom.js/effect-tg)
66
[![codecov](https://img.shields.io/codecov/c/github/grom-dev/effect-tg?style=flat&logo=codecov&logoColor=%23f07&label=Coverage&labelColor=%23fff&color=%23f07)](https://codecov.io/gh/grom-dev/effect-tg)
77

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@antfu/eslint-config": "7.6.1",
5353
"@effect/language-service": "0.77.0",
5454
"@effect/platform": "0.94.5",
55-
"@grom.js/bot-api-spec": "0.7.1",
55+
"@grom.js/bot-api-spec": "0.8.0",
5656
"@grom.js/tgx": "1.1.0",
5757
"@types/node": "22.19.13",
5858
"@vitest/coverage-v8": "4.0.18",

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/internal/botApi.gen.ts

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export interface BotApi {
8282
sendChecklist: BotApiMethod<'sendChecklist'>
8383
/** 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. */
8484
sendDice: BotApiMethod<'sendDice'>
85-
/** Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns _True_ on success. */
85+
/** Use this method to stream a partial message to a user while the message is being generated. Returns _True_ on success. */
8686
sendMessageDraft: BotApiMethod<'sendMessageDraft'>
8787
/**
8888
* 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.
@@ -116,6 +116,8 @@ export interface BotApi {
116116
promoteChatMember: BotApiMethod<'promoteChatMember'>
117117
/** Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns _True_ on success. */
118118
setChatAdministratorCustomTitle: BotApiMethod<'setChatAdministratorCustomTitle'>
119+
/** Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the _can\_manage\_tags_ administrator right. Returns _True_ on success. */
120+
setChatMemberTag: BotApiMethod<'setChatMemberTag'>
119121
/** Use this method to ban a channel chat in a supergroup or a channel. Until the chat is [unbanned](https://core.telegram.org/bots/api#unbanchatsenderchat), the owner of the banned chat won't be able to send messages on behalf of **any of their channels**. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns _True_ on success. */
120122
banChatSenderChat: BotApiMethod<'banChatSenderChat'>
121123
/** 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. */
@@ -667,6 +669,8 @@ export declare namespace Types {
667669
sender_boost_count?: number
668670
/** The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account. */
669671
sender_business_bot?: Types.User
672+
/** Tag or custom title of the sender of the message; for supergroups only */
673+
sender_tag?: string
670674
/** Date the message was sent in Unix time. It is always a positive number, representing a valid date. */
671675
date: number
672676
/** Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier. */
@@ -699,7 +703,7 @@ export declare namespace Types {
699703
is_from_offline?: true
700704
/** _True_, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can't be edited. */
701705
is_paid_post?: true
702-
/** The unique identifier of a media message group this message belongs to */
706+
/** The unique identifier inside this chat of a media message group this message belongs to */
703707
media_group_id?: string
704708
/** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
705709
author_signature?: string
@@ -861,7 +865,7 @@ export declare namespace Types {
861865
video_chat_participants_invited?: Types.VideoChatParticipantsInvited
862866
/** Service message: data sent by a Web App */
863867
web_app_data?: Types.WebAppData
864-
/** Inline keyboard attached to the message. `login_url` buttons are represented as ordinary `url` buttons. */
868+
/** [Inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) attached to the message. `login_url` buttons are represented as ordinary `url` buttons. */
865869
reply_markup?: Types.InlineKeyboardMarkup
866870
}
867871

@@ -891,8 +895,8 @@ export declare namespace Types {
891895

892896
/** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
893897
export interface MessageEntity {
894-
/** Type of the entity. Currently, can be “mention” (`@username`), “hashtag” (`#hashtag` or `#hashtag@chatusername`), “cashtag” (`$USD` or `$USD@chatusername`), “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), “expandable\_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text\_link” (for clickable text URLs), “text\_mention” (for users [without usernames](https://telegram.org/blog/edit#new-mentions)), “custom\_emoji” (for inline custom emoji stickers) */
895-
type: 'mention' | 'hashtag' | 'cashtag' | 'bot_command' | 'url' | 'email' | 'phone_number' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'spoiler' | 'blockquote' | 'expandable_blockquote' | 'code' | 'pre' | 'text_link' | 'text_mention' | 'custom_emoji'
898+
/** Type of the entity. Currently, can be “mention” (`@username`), “hashtag” (`#hashtag` or `#hashtag@chatusername`), “cashtag” (`$USD` or `$USD@chatusername`), “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), “expandable\_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text\_link” (for clickable text URLs), “text\_mention” (for users [without usernames](https://telegram.org/blog/edit#new-mentions)), “custom\_emoji” (for inline custom emoji stickers), or “date\_time” (for formatted date and time) */
899+
type: 'mention' | 'hashtag' | 'cashtag' | 'bot_command' | 'url' | 'email' | 'phone_number' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'spoiler' | 'blockquote' | 'expandable_blockquote' | 'code' | 'pre' | 'text_link' | 'text_mention' | 'custom_emoji' | 'date_time'
896900
/** Offset in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length) to the start of the entity */
897901
offset: number
898902
/** Length of the entity in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length) */
@@ -905,6 +909,10 @@ export declare namespace Types {
905909
language?: string
906910
/** For “custom\_emoji” only, unique identifier of the custom emoji. Use [getCustomEmojiStickers](https://core.telegram.org/bots/api#getcustomemojistickers) to get full information about the sticker */
907911
custom_emoji_id?: string
912+
/** For “date\_time” only, the Unix time associated with the entity */
913+
unix_time?: number
914+
/** For “date\_time” only, the string that defines the formatting of the date and time. See [date-time entity formatting](https://core.telegram.org/bots/api#date-time-entity-formatting) for more details. */
915+
date_time_format?: string
908916
}
909917

910918
/** This object contains information about the quoted part of a message that is replied to by the given message. */
@@ -2204,6 +2212,8 @@ export declare namespace Types {
22042212
can_manage_topics?: boolean
22052213
/** _True_, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */
22062214
can_manage_direct_messages?: boolean
2215+
/** _True_, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can\_pin\_messages. */
2216+
can_manage_tags?: boolean
22072217
}
22082218

22092219
/** This object represents changes in the status of a chat member. */
@@ -2290,6 +2300,8 @@ export declare namespace Types {
22902300
can_manage_topics?: boolean
22912301
/** _True_, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */
22922302
can_manage_direct_messages?: boolean
2303+
/** _True_, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can\_pin\_messages. */
2304+
can_manage_tags?: boolean
22932305
/** Custom title for this user */
22942306
custom_title?: string
22952307
}
@@ -2298,6 +2310,8 @@ export declare namespace Types {
22982310
export interface ChatMemberMember {
22992311
/** The member's status in the chat, always “member” */
23002312
status: 'member'
2313+
/** Tag of the member */
2314+
tag?: string
23012315
/** Information about the user */
23022316
user: Types.User
23032317
/** Date when the user's subscription will expire; Unix time */
@@ -2308,6 +2322,8 @@ export declare namespace Types {
23082322
export interface ChatMemberRestricted {
23092323
/** The member's status in the chat, always “restricted” */
23102324
status: 'restricted'
2325+
/** Tag of the member */
2326+
tag?: string
23112327
/** Information about the user */
23122328
user: Types.User
23132329
/** _True_, if the user is a member of the chat at the moment of the request */
@@ -2332,6 +2348,8 @@ export declare namespace Types {
23322348
can_send_other_messages: boolean
23332349
/** _True_, if the user is allowed to add web page previews to their messages */
23342350
can_add_web_page_previews: boolean
2351+
/** _True_, if the user is allowed to edit their own tag */
2352+
can_edit_tag: boolean
23352353
/** _True_, if the user is allowed to change the chat title, photo and other settings */
23362354
can_change_info: boolean
23372355
/** _True_, if the user is allowed to invite new users to the chat */
@@ -2400,6 +2418,8 @@ export declare namespace Types {
24002418
can_send_other_messages?: boolean
24012419
/** _True_, if the user is allowed to add web page previews to their messages */
24022420
can_add_web_page_previews?: boolean
2421+
/** _True_, if the user is allowed to edit their own tag */
2422+
can_edit_tag?: boolean
24032423
/** _True_, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */
24042424
can_change_info?: boolean
24052425
/** _True_, if the user is allowed to invite new users to the chat */
@@ -3792,7 +3812,7 @@ export declare namespace Types {
37923812
mime_type: 'application/pdf' | 'application/zip'
37933813
/** Short description of the result */
37943814
description?: string
3795-
/** Inline keyboard attached to the message */
3815+
/** [Inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) attached to the message */
37963816
reply_markup?: Types.InlineKeyboardMarkup
37973817
/** Content of the message to be sent instead of the file */
37983818
input_message_content?: Types.InputMessageContent
@@ -5401,7 +5421,7 @@ export interface MethodParams {
54015421
message_effect_id?: string
54025422
/** An object for description of the message to reply to */
54035423
reply_parameters?: Types.ReplyParameters
5404-
/** An object for an inline keyboard */
5424+
/** An object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) */
54055425
reply_markup?: Types.InlineKeyboardMarkup
54065426
}
54075427
sendDice: {
@@ -5559,6 +5579,8 @@ export interface MethodParams {
55595579
can_manage_topics?: boolean
55605580
/** Pass _True_ if the administrator can manage direct messages within the channel and decline suggested posts; for channels only */
55615581
can_manage_direct_messages?: boolean
5582+
/** Pass _True_ if the administrator can edit the tags of regular members; for groups and supergroups only */
5583+
can_manage_tags?: boolean
55625584
}
55635585
setChatAdministratorCustomTitle: {
55645586
/** Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`) */
@@ -5568,6 +5590,14 @@ export interface MethodParams {
55685590
/** New custom title for the administrator; 0-16 characters, emoji are not allowed */
55695591
custom_title: string
55705592
}
5593+
setChatMemberTag: {
5594+
/** Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`) */
5595+
chat_id: number | string
5596+
/** Unique identifier of the target user */
5597+
user_id: number
5598+
/** New tag for the member; 0-16 characters, emoji are not allowed */
5599+
tag?: string
5600+
}
55715601
banChatSenderChat: {
55725602
/** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */
55735603
chat_id: number | string
@@ -6268,7 +6298,7 @@ export interface MethodParams {
62686298
message_id: number
62696299
/** An object for the new checklist */
62706300
checklist: Types.InputChecklist
6271-
/** An object for the new inline keyboard for the message */
6301+
/** An object for the new [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) for the message */
62726302
reply_markup?: Types.InlineKeyboardMarkup
62736303
}
62746304
editMessageReplyMarkup: void | {
@@ -6730,6 +6760,7 @@ export interface MethodResults {
67306760
restrictChatMember: true
67316761
promoteChatMember: true
67326762
setChatAdministratorCustomTitle: true
6763+
setChatMemberTag: true
67336764
banChatSenderChat: true
67346765
unbanChatSenderChat: true
67356766
setChatPermissions: true

0 commit comments

Comments
 (0)