grammy 1.40.1 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/out/context.d.ts +20 -1
- package/out/context.js +24 -1
- package/out/convenience/constants.d.ts +12 -12
- package/out/convenience/constants.js +11 -11
- package/out/core/api.d.ts +12 -1
- package/out/core/api.js +14 -1
- package/out/web.mjs +24 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- deno-fmt-ignore-start -->
|
|
12
12
|
|
|
13
|
-
[](https://core.telegram.org/bots/api)
|
|
14
14
|
[](https://deno.land/x/grammy)
|
|
15
15
|
[](https://www.npmjs.org/package/grammy)
|
|
16
16
|
[](#contributors-)
|
package/out/context.d.ts
CHANGED
|
@@ -473,7 +473,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
473
473
|
*/
|
|
474
474
|
reply(text: string, other?: Other<"sendMessage", "chat_id" | "text">, signal?: AbortSignal): Promise<Message.TextMessage>;
|
|
475
475
|
/**
|
|
476
|
-
* Context-aware alias for `api.sendMessageDraft`. Use this method to stream a partial message to a user while the message is being generated
|
|
476
|
+
* Context-aware alias for `api.sendMessageDraft`. Use this method to stream a partial message to a user while the message is being generated. Returns True on success.
|
|
477
477
|
*
|
|
478
478
|
* @param text Text of the message to be sent, 1-4096 characters after entities parsing
|
|
479
479
|
* @param other Optional remaining parameters, confer the official reference below
|
|
@@ -905,6 +905,25 @@ export declare class Context implements RenamedUpdate {
|
|
|
905
905
|
* **Official reference:** https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
|
906
906
|
*/
|
|
907
907
|
setChatAdministratorCustomTitle(user_id: number, custom_title: string, signal?: AbortSignal): Promise<true>;
|
|
908
|
+
/**
|
|
909
|
+
* Context-aware alias for `api.setChatMemberTag`. 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.
|
|
910
|
+
*
|
|
911
|
+
* @param tag New tag for the member; 0-16 characters, emoji are not allowed
|
|
912
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
913
|
+
*
|
|
914
|
+
* **Official reference:** https://core.telegram.org/bots/api#setChatMemberTag
|
|
915
|
+
*/
|
|
916
|
+
setAuthorTag(tag: string, signal?: AbortSignal): Promise<true>;
|
|
917
|
+
/**
|
|
918
|
+
* Context-aware alias for `api.setChatMemberTag`. 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.
|
|
919
|
+
*
|
|
920
|
+
* @param user_id Unique identifier of the target user
|
|
921
|
+
* @param tag New tag for the member; 0-16 characters, emoji are not allowed
|
|
922
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
923
|
+
*
|
|
924
|
+
* **Official reference:** https://core.telegram.org/bots/api#setChatMemberTag
|
|
925
|
+
*/
|
|
926
|
+
setChatMemberTag(user_id: number, tag: string, signal?: AbortSignal): Promise<true>;
|
|
908
927
|
/**
|
|
909
928
|
* Context-aware alias for `api.banChatSenderChat`. Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, 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.
|
|
910
929
|
*
|
package/out/context.js
CHANGED
|
@@ -678,7 +678,7 @@ class Context {
|
|
|
678
678
|
}, signal);
|
|
679
679
|
}
|
|
680
680
|
/**
|
|
681
|
-
* Context-aware alias for `api.sendMessageDraft`. Use this method to stream a partial message to a user while the message is being generated
|
|
681
|
+
* Context-aware alias for `api.sendMessageDraft`. Use this method to stream a partial message to a user while the message is being generated. Returns True on success.
|
|
682
682
|
*
|
|
683
683
|
* @param text Text of the message to be sent, 1-4096 characters after entities parsing
|
|
684
684
|
* @param other Optional remaining parameters, confer the official reference below
|
|
@@ -1368,6 +1368,29 @@ class Context {
|
|
|
1368
1368
|
setChatAdministratorCustomTitle(user_id, custom_title, signal) {
|
|
1369
1369
|
return this.api.setChatAdministratorCustomTitle(orThrow(this.chatId, "setChatAdministratorCustomTitle"), user_id, custom_title, signal);
|
|
1370
1370
|
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Context-aware alias for `api.setChatMemberTag`. 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.
|
|
1373
|
+
*
|
|
1374
|
+
* @param tag New tag for the member; 0-16 characters, emoji are not allowed
|
|
1375
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1376
|
+
*
|
|
1377
|
+
* **Official reference:** https://core.telegram.org/bots/api#setChatMemberTag
|
|
1378
|
+
*/
|
|
1379
|
+
setAuthorTag(tag, signal) {
|
|
1380
|
+
return this.api.setChatMemberTag(orThrow(this.chatId, "setChatMemberTag"), orThrow(this.from, "setChatMemberTag").id, tag, signal);
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* Context-aware alias for `api.setChatMemberTag`. 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.
|
|
1384
|
+
*
|
|
1385
|
+
* @param user_id Unique identifier of the target user
|
|
1386
|
+
* @param tag New tag for the member; 0-16 characters, emoji are not allowed
|
|
1387
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1388
|
+
*
|
|
1389
|
+
* **Official reference:** https://core.telegram.org/bots/api#setChatMemberTag
|
|
1390
|
+
*/
|
|
1391
|
+
setChatMemberTag(user_id, tag, signal) {
|
|
1392
|
+
return this.api.setChatMemberTag(orThrow(this.chatId, "setChatMemberTag"), user_id, tag, signal);
|
|
1393
|
+
}
|
|
1371
1394
|
/**
|
|
1372
1395
|
* Context-aware alias for `api.banChatSenderChat`. Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, 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.
|
|
1373
1396
|
*
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { DEFAULT_UPDATE_TYPES } from "../bot.js";
|
|
2
2
|
declare const ALL_UPDATE_TYPES: readonly ["message", "edited_message", "channel_post", "edited_channel_post", "business_connection", "business_message", "edited_business_message", "deleted_business_messages", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "purchased_paid_media", "poll", "poll_answer", "my_chat_member", "chat_join_request", "chat_boost", "removed_chat_boost", "chat_member", "message_reaction", "message_reaction_count"];
|
|
3
3
|
declare const ALL_CHAT_PERMISSIONS: {
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
4
|
+
readonly can_send_messages: true;
|
|
5
|
+
readonly can_send_audios: true;
|
|
6
|
+
readonly can_send_documents: true;
|
|
7
|
+
readonly can_send_photos: true;
|
|
8
|
+
readonly can_send_videos: true;
|
|
9
|
+
readonly can_send_video_notes: true;
|
|
10
|
+
readonly can_send_voice_notes: true;
|
|
11
|
+
readonly can_send_polls: true;
|
|
12
|
+
readonly can_send_other_messages: true;
|
|
13
|
+
readonly can_add_web_page_previews: true;
|
|
10
14
|
readonly can_change_info: true;
|
|
11
15
|
readonly can_invite_users: true;
|
|
12
|
-
readonly
|
|
13
|
-
readonly can_edit_stories: true;
|
|
14
|
-
readonly can_delete_stories: true;
|
|
15
|
-
readonly can_post_messages: true;
|
|
16
|
-
readonly can_edit_messages: true;
|
|
16
|
+
readonly can_edit_tag: true;
|
|
17
17
|
readonly can_pin_messages: true;
|
|
18
18
|
readonly can_manage_topics: true;
|
|
19
19
|
};
|
|
@@ -77,7 +77,7 @@ export interface ApiConstants {
|
|
|
77
77
|
* await ctx.restrictAuthor(ALL_CHAT_PERMISSIONS);
|
|
78
78
|
* ```
|
|
79
79
|
*
|
|
80
|
-
* See the [Bot API reference](https://core.telegram.org/bots/api#
|
|
80
|
+
* See the [Bot API reference](https://core.telegram.org/bots/api#chatpermissions)
|
|
81
81
|
* for more information.
|
|
82
82
|
*/
|
|
83
83
|
ALL_CHAT_PERMISSIONS: keyof typeof ALL_CHAT_PERMISSIONS;
|
|
@@ -9,19 +9,19 @@ const ALL_UPDATE_TYPES = [
|
|
|
9
9
|
"message_reaction_count",
|
|
10
10
|
];
|
|
11
11
|
const ALL_CHAT_PERMISSIONS = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
can_send_messages: true,
|
|
13
|
+
can_send_audios: true,
|
|
14
|
+
can_send_documents: true,
|
|
15
|
+
can_send_photos: true,
|
|
16
|
+
can_send_videos: true,
|
|
17
|
+
can_send_video_notes: true,
|
|
18
|
+
can_send_voice_notes: true,
|
|
19
|
+
can_send_polls: true,
|
|
20
|
+
can_send_other_messages: true,
|
|
21
|
+
can_add_web_page_previews: true,
|
|
18
22
|
can_change_info: true,
|
|
19
23
|
can_invite_users: true,
|
|
20
|
-
|
|
21
|
-
can_edit_stories: true,
|
|
22
|
-
can_delete_stories: true,
|
|
23
|
-
can_post_messages: true,
|
|
24
|
-
can_edit_messages: true,
|
|
24
|
+
can_edit_tag: true,
|
|
25
25
|
can_pin_messages: true,
|
|
26
26
|
can_manage_topics: true,
|
|
27
27
|
};
|
package/out/core/api.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
155
155
|
*/
|
|
156
156
|
sendMessage(chat_id: number | string, text: string, other?: Other<R, "sendMessage", "chat_id" | "text">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.TextMessage>;
|
|
157
157
|
/**
|
|
158
|
-
* Use this method to stream a partial message to a user while the message is being generated
|
|
158
|
+
* Use this method to stream a partial message to a user while the message is being generated. Returns True on success.
|
|
159
159
|
*
|
|
160
160
|
* @param chat_id Unique identifier for the target private chat
|
|
161
161
|
* @param draft_id Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated
|
|
@@ -622,6 +622,17 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
622
622
|
* **Official reference:** https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
|
623
623
|
*/
|
|
624
624
|
setChatAdministratorCustomTitle(chat_id: number | string, user_id: number, custom_title: string, signal?: AbortSignal): Promise<true>;
|
|
625
|
+
/**
|
|
626
|
+
* 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.
|
|
627
|
+
*
|
|
628
|
+
* @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
|
|
629
|
+
* @param user_id Unique identifier of the target user
|
|
630
|
+
* @param tag New tag for the member; 0-16 characters, emoji are not allowed
|
|
631
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
632
|
+
*
|
|
633
|
+
* **Official reference:** https://core.telegram.org/bots/api#setChatMemberTag
|
|
634
|
+
*/
|
|
635
|
+
setChatMemberTag(chat_id: number | string, user_id: number, tag: string, signal?: AbortSignal): Promise<true>;
|
|
625
636
|
/**
|
|
626
637
|
* Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, 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.
|
|
627
638
|
*
|
package/out/core/api.js
CHANGED
|
@@ -140,7 +140,7 @@ class Api {
|
|
|
140
140
|
return this.raw.sendMessage({ chat_id, text, ...other }, signal);
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
-
* Use this method to stream a partial message to a user while the message is being generated
|
|
143
|
+
* Use this method to stream a partial message to a user while the message is being generated. Returns True on success.
|
|
144
144
|
*
|
|
145
145
|
* @param chat_id Unique identifier for the target private chat
|
|
146
146
|
* @param draft_id Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated
|
|
@@ -708,6 +708,19 @@ class Api {
|
|
|
708
708
|
setChatAdministratorCustomTitle(chat_id, user_id, custom_title, signal) {
|
|
709
709
|
return this.raw.setChatAdministratorCustomTitle({ chat_id, user_id, custom_title }, signal);
|
|
710
710
|
}
|
|
711
|
+
/**
|
|
712
|
+
* 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.
|
|
713
|
+
*
|
|
714
|
+
* @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
|
|
715
|
+
* @param user_id Unique identifier of the target user
|
|
716
|
+
* @param tag New tag for the member; 0-16 characters, emoji are not allowed
|
|
717
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
718
|
+
*
|
|
719
|
+
* **Official reference:** https://core.telegram.org/bots/api#setChatMemberTag
|
|
720
|
+
*/
|
|
721
|
+
setChatMemberTag(chat_id, user_id, tag, signal) {
|
|
722
|
+
return this.raw.setChatMemberTag({ chat_id, user_id, tag }, signal);
|
|
723
|
+
}
|
|
711
724
|
/**
|
|
712
725
|
* Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, 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.
|
|
713
726
|
*
|
package/out/web.mjs
CHANGED
|
@@ -1074,6 +1074,12 @@ class Context {
|
|
|
1074
1074
|
setChatAdministratorCustomTitle(user_id, custom_title, signal) {
|
|
1075
1075
|
return this.api.setChatAdministratorCustomTitle(orThrow(this.chatId, "setChatAdministratorCustomTitle"), user_id, custom_title, signal);
|
|
1076
1076
|
}
|
|
1077
|
+
setAuthorTag(tag, signal) {
|
|
1078
|
+
return this.api.setChatMemberTag(orThrow(this.chatId, "setChatMemberTag"), orThrow(this.from, "setChatMemberTag").id, tag, signal);
|
|
1079
|
+
}
|
|
1080
|
+
setChatMemberTag(user_id, tag, signal) {
|
|
1081
|
+
return this.api.setChatMemberTag(orThrow(this.chatId, "setChatMemberTag"), user_id, tag, signal);
|
|
1082
|
+
}
|
|
1077
1083
|
banChatSenderChat(sender_chat_id, signal) {
|
|
1078
1084
|
return this.api.banChatSenderChat(orThrow(this.chatId, "banChatSenderChat"), sender_chat_id, signal);
|
|
1079
1085
|
}
|
|
@@ -3120,6 +3126,13 @@ class Api {
|
|
|
3120
3126
|
custom_title
|
|
3121
3127
|
}, signal);
|
|
3122
3128
|
}
|
|
3129
|
+
setChatMemberTag(chat_id, user_id, tag, signal) {
|
|
3130
|
+
return this.raw.setChatMemberTag({
|
|
3131
|
+
chat_id,
|
|
3132
|
+
user_id,
|
|
3133
|
+
tag
|
|
3134
|
+
}, signal);
|
|
3135
|
+
}
|
|
3123
3136
|
banChatSenderChat(chat_id, sender_chat_id, signal) {
|
|
3124
3137
|
return this.raw.banChatSenderChat({
|
|
3125
3138
|
chat_id,
|
|
@@ -4245,19 +4258,19 @@ const ALL_UPDATE_TYPES = [
|
|
|
4245
4258
|
"message_reaction_count"
|
|
4246
4259
|
];
|
|
4247
4260
|
const ALL_CHAT_PERMISSIONS = {
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4261
|
+
can_send_messages: true,
|
|
4262
|
+
can_send_audios: true,
|
|
4263
|
+
can_send_documents: true,
|
|
4264
|
+
can_send_photos: true,
|
|
4265
|
+
can_send_videos: true,
|
|
4266
|
+
can_send_video_notes: true,
|
|
4267
|
+
can_send_voice_notes: true,
|
|
4268
|
+
can_send_polls: true,
|
|
4269
|
+
can_send_other_messages: true,
|
|
4270
|
+
can_add_web_page_previews: true,
|
|
4254
4271
|
can_change_info: true,
|
|
4255
4272
|
can_invite_users: true,
|
|
4256
|
-
|
|
4257
|
-
can_edit_stories: true,
|
|
4258
|
-
can_delete_stories: true,
|
|
4259
|
-
can_post_messages: true,
|
|
4260
|
-
can_edit_messages: true,
|
|
4273
|
+
can_edit_tag: true,
|
|
4261
4274
|
can_pin_messages: true,
|
|
4262
4275
|
can_manage_topics: true
|
|
4263
4276
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grammy",
|
|
3
3
|
"description": "The Telegram Bot Framework.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.41.0",
|
|
5
5
|
"author": "KnorpelSenf",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"backport": "deno2node tsconfig.json"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@grammyjs/types": "3.
|
|
20
|
+
"@grammyjs/types": "3.25.0",
|
|
21
21
|
"abort-controller": "^3.0.0",
|
|
22
22
|
"debug": "^4.4.3",
|
|
23
23
|
"node-fetch": "^2.7.0"
|