You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -5,32 +5,39 @@ import * as tt from './telegram-types'
5
5
import{Telegram}from'./telegram'
6
6
7
7
exportdeclareclassTelegrafContext{
8
+
tg: Telegram
9
+
update: tt.Update
8
10
updateType: tt.UpdateType
9
11
updateSubTypes: tt.MessageSubTypes[]
10
-
update: tt.Update
11
-
tg: Telegram
12
12
botInfo?: tt.User
13
-
telegram: Telegram
14
-
callbackQuery?: tt.CallbackQuery
15
-
channelPost?: tt.Message
16
-
chat?: tt.Chat
17
-
chosenInlineResult?: tt.ChosenInlineResult
18
-
editedChannelPost?: tt.Message
19
-
editedMessage?: tt.Message
20
-
from?: tt.User
21
-
inlineQuery?: tt.InlineQuery
22
13
match?: RegExpExecArray|null
23
14
me?: string
15
+
telegram: Telegram
24
16
message?: tt.Message
17
+
editedMessage?: tt.Message
18
+
inlineQuery?: tt.InlineQuery
19
+
shippingQuery?: tt.ShippingQuery
20
+
preCheckoutQuery?: tt.PreCheckoutQuery
21
+
chosenInlineResult?: tt.ChosenInlineResult
22
+
channelPost?: tt.Message
23
+
editedChannelPost?: tt.Message
24
+
callbackQuery?: tt.CallbackQuery
25
25
poll?: tt.Poll
26
26
pollAnswer?: tt.PollAnswer
27
-
preCheckoutQuery?: tt.PreCheckoutQuery
28
-
shippingQuery?: tt.ShippingQuery
27
+
chat?: tt.Chat
28
+
from?: tt.User
29
+
inlineMessageId?: string
30
+
passportData?: tt.PassportData
31
+
state: object
32
+
webhookReply: boolean
29
33
30
34
constructor(
31
35
update: tt.Update,
32
36
telegram: Telegram,
33
-
options?: {username?: string}
37
+
options?: {
38
+
username?: string,
39
+
channelMode?: boolean
40
+
}
34
41
)
35
42
36
43
/**
@@ -63,12 +70,6 @@ export declare class TelegrafContext {
63
70
stickerData: tt.StickerData
64
71
): Promise<boolean>
65
72
66
-
/**
67
-
* 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 admin rights.
68
-
* @returns True on success
69
-
*/
70
-
deleteChatPhoto(): Promise<boolean>
71
-
72
73
/**
73
74
* Use this method to delete a sticker from a set created by the bot.
74
75
* @param sticker File identifier of the sticker
@@ -109,7 +110,7 @@ export declare class TelegrafContext {
109
110
110
111
/**
111
112
* 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 admin rights. Pass True for all boolean parameters to lift restrictions from a user. Returns True on success.
112
-
* @paramuser_id Unique identifier of the target user
113
+
* @paramuserId Unique identifier of the target user
113
114
* @param extra Additional params for restrict chat member
114
115
* @returns True on success
115
116
*/
@@ -125,12 +126,41 @@ export declare class TelegrafContext {
* Use this method to set a new group sticker set for a supergroup.
131
+
* The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
132
+
* Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method
133
+
* @param setName Name of the sticker set to be set as the group sticker set
134
+
* @returns True on success.
135
+
*/
136
+
setChatStickerSet(
137
+
setName: string
138
+
): Promise<boolean>
139
+
140
+
/**
141
+
* Use this method to delete a group sticker set from a supergroup.
142
+
* The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
143
+
* Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method
144
+
* @returns True on success.
145
+
*/
146
+
deleteChatStickerSet(): Promise<boolean>
147
+
128
148
/**
129
149
* Use this method for your bot to leave a group, supergroup or channel
130
150
* @returns True on success
131
151
*/
132
152
leaveChat(): Promise<boolean>
133
153
154
+
/**
155
+
* Use this method to set default chat permissions for all members.
156
+
* The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights.
157
+
* @param permissions New default chat permissions
158
+
* @returns True on success
159
+
*/
160
+
setChatPermissions(
161
+
permissions: tt.ChatPermissions
162
+
): Promise<boolean>
163
+
134
164
/**
135
165
* Use this method to pin a message in a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights
136
166
* @param messageId Identifier of a message to pin
@@ -246,6 +276,36 @@ export declare class TelegrafContext {
246
276
extra?: tt.ExtraLocation
247
277
): Promise<tt.MessageLocation>
248
278
279
+
/**
280
+
* Use this method to send information about a venue
281
+
* @param latitude Latitude of location
282
+
* @param longitude Longitude of location
283
+
* @param title Name of the venue
284
+
* @param address Address of the venue
285
+
* @param extra Additional params for sendVenue
286
+
* @returns a Message on success
287
+
*/
288
+
replyWithVenue(
289
+
latitude: number,
290
+
longitude: number,
291
+
title: string,
292
+
address: string,
293
+
extra?: tt.ExtraVenue
294
+
): Promise<tt.MessageVenue>
295
+
296
+
/**
297
+
* Use this method to send phone contacts
298
+
* @param phoneNumber Contact's phone number
299
+
* @param firstName Contact's first name
300
+
* @param extra Additional params for sendContact
301
+
* @returns a Message on success
302
+
*/
303
+
replyWithContact(
304
+
phoneNumber: string,
305
+
firstName: string,
306
+
extra?: tt.ExtraContact
307
+
): Promise<tt.MessageContact>
308
+
249
309
/**
250
310
* The Bot API supports basic formatting for messages
251
311
* @param markdown You can use bold and italic text, as well as inline links and pre-formatted code in your bots' messages.
@@ -257,6 +317,17 @@ export declare class TelegrafContext {
257
317
extra?: tt.ExtraSendMessage
258
318
): Promise<tt.Message>
259
319
320
+
/**
321
+
* The Bot API supports basic formatting for messages
322
+
* @param markdown You can use bold and italic text, as well as inline links and pre-formatted code in your bots' messages.
323
+
* @param extra Additional params to send message
324
+
* @returns a Message on success
325
+
*/
326
+
replyWithMarkdownV2(
327
+
markdown: string,
328
+
extra?: tt.ExtraSendMessage
329
+
): Promise<tt.Message>
330
+
260
331
/**
261
332
* Use this method to send photos
262
333
* @param photo Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data
@@ -336,6 +407,28 @@ export declare class TelegrafContext {
336
407
extra?: tt.ExtraVideo
337
408
): Promise<tt.MessageVideo>
338
409
410
+
/**
411
+
* Use this method to send .gif animations
412
+
* @param animation Animation to send. Pass a file_id as String to send a GIF that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a GIF from the Internet, or upload a new GIF using multipart/form-data
413
+
* @param extra Additional params for sendAnimation
414
+
* @returns a Message on success
415
+
*/
416
+
replyWithAnimation(
417
+
animation: tt.InputFile,
418
+
extra?: tt.ExtraAnimation
419
+
): Promise<tt.MessageAnimation>
420
+
421
+
/**
422
+
* Use this method to send .gif animations
423
+
* @param videoNote video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. Sending video notes by a URL is currently unsupported
424
+
* @param extra Additional params for sendVideoNote
425
+
* @returns a Message on success
426
+
*/
427
+
replyWithVideoNote(
428
+
videoNote: tt.InputFileVideoNote,
429
+
extra?: tt.ExtraAnimation
430
+
): Promise<tt.MessageVideoNote>
431
+
339
432
/**
340
433
* 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 or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
341
434
* @param voice Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data
@@ -363,13 +456,25 @@ export declare class TelegrafContext {
* Use this method to send answers to an inline query.
406
-
* No more than 50 results per query are allowed.
407
-
* @returns On success, True is returned.
408
-
* @param results Array of results for the inline query
409
-
* @param extra Extra optional parameters
410
-
*/
411
-
answerInlineQuery(
412
-
results: tt.InlineQueryResult[],
413
-
extra?: tt.ExtraAnswerInlineQuery
414
-
): Promise<boolean>
415
-
416
509
/**
417
510
* Use this method to edit text and game messages sent by the bot or via the bot (for inline bots).
418
511
* @returns On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
@@ -435,15 +528,6 @@ export declare class TelegrafContext {
435
528
extra?: tt.ExtraEditCaption
436
529
): Promise<tt.Message|boolean>
437
530
438
-
/**
439
-
* Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
440
-
* @returns On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
441
-
* @param markup Markup of inline keyboard
442
-
*/
443
-
editMessageReplyMarkup(
444
-
markup?: tt.InlineKeyboardMarkup
445
-
): Promise<tt.Message|boolean>
446
-
447
531
/**
448
532
* Use this method to edit animation, audio, document, photo, or video messages.
449
533
* @returns On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
@@ -455,6 +539,15 @@ export declare class TelegrafContext {
455
539
extra?: tt.ExtraEditMessageMedia
456
540
): Promise<tt.Message|boolean>
457
541
542
+
/**
543
+
* Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
544
+
* @returns On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
545
+
* @param markup Markup of inline keyboard
546
+
*/
547
+
editMessageReplyMarkup(
548
+
markup?: tt.InlineKeyboardMarkup
549
+
): Promise<tt.Message|boolean>
550
+
458
551
/**
459
552
* Use this method to edit live location messages
460
553
* @returns On success, if the edited message was sent by the bot, the edited message is returned, otherwise True is returned.
@@ -495,15 +588,53 @@ export declare class TelegrafContext {
495
588
496
589
/**
497
590
* 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 admin rights. Pass False for all boolean parameters to demote a user.
498
-
* @param chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
499
591
* @param userId Unique identifier of the target user
592
+
* @param extra Extra parameters for promoteChatMember
500
593
* @returns True on success
501
594
*/
502
595
promoteChatMember(
503
596
userId: number,
504
597
extra: tt.ExtraPromoteChatMember
505
598
): Promise<boolean>
506
599
600
+
/**
601
+
* Use this method to set a custom title for an administrator in a supergroup promoted by the bot
602
+
* @param userId Unique identifier of the target user
603
+
* @param title New custom title for the administrator; 0-16 characters, emoji are not allowed
604
+
* @returns True on success
605
+
*/
606
+
setChatAdministratorCustomTitle(
607
+
userId: number,
608
+
title: string
609
+
): Promise<boolean>
610
+
611
+
/**
612
+
* 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 admin rights
* 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 admin rights.
620
+
* @returns True on success
621
+
*/
622
+
deleteChatPhoto(): Promise<boolean>
623
+
624
+
/**
625
+
* 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 admin rights
626
+
* @param title New chat title, 1-255 characters
627
+
* @returns True on success
628
+
*/
629
+
setChatTitle(title: string): Promise<boolean>
630
+
631
+
/**
632
+
* 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 admin rights
633
+
* @param description New chat description, 0-255 characters
* 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 admin rights
540
-
* @param title New chat title, 1-255 characters
681
+
* Use this method to set the thumbnail of a sticker set.
682
+
* Animated thumbnails can be set for animated sticker sets only
683
+
* @param name Sticker set name
684
+
* @param userId User identifier of the sticker set owner
685
+
* @param thumb New thumbnail. See [documentation](https://core.telegram.org/bots/api#setstickersetthumb)
686
+
* @returns True on success.
687
+
*/
688
+
setStickerSetThumb(
689
+
name: string,
690
+
userId: number,
691
+
thumb: tt.InputFile,
692
+
): Promise<boolean>
693
+
694
+
/**
695
+
* Informs a user that some of the Telegram Passport elements they provided contains errors.
696
+
* 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).
697
+
*
698
+
* Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason.
699
+
* For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc.
700
+
* Supply some details in the error message to make sure the user knows how to correct the issues.
701
+
* @param errors An array describing the errors
702
+
* @returns True on success.
703
+
*/
704
+
setPassportDataErrors(
705
+
errors: tt.PassportElementError[]
706
+
): Promise<boolean>
707
+
708
+
/**
709
+
* Use this method to get the current list of the bot's commands. Requires no parameters.
710
+
* @returns Array of BotCommand on success.
711
+
*/
712
+
getMyCommands(): Promise<tt.BotCommand[]>
713
+
714
+
/**
715
+
* Use this method to change the list of the bot's commands.
716
+
* @param commands A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
0 commit comments