@aracna/telegram-bot 1.9.14 → 2.0.1

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.
Files changed (194) hide show
  1. package/apis/telegram-api.d.ts +9 -0
  2. package/apis/telegram-api.js +55 -0
  3. package/apis/telegram-file-api.d.ts +7 -0
  4. package/apis/telegram-file-api.js +14 -0
  5. package/classes/client.d.ts +46 -0
  6. package/classes/client.js +409 -0
  7. package/definitions/constants.d.ts +10 -0
  8. package/definitions/constants.js +53 -1
  9. package/definitions/enums.d.ts +1 -20
  10. package/definitions/enums.js +2 -22
  11. package/definitions/interfaces.d.ts +82 -78
  12. package/definitions/telegram-api-definitions.d.ts +12 -0
  13. package/definitions/telegram-api-definitions.js +2 -0
  14. package/definitions/types.d.ts +3 -2
  15. package/index.d.ts +475 -441
  16. package/index.js +236 -20
  17. package/loggers/class-logger.d.ts +2 -0
  18. package/loggers/{module.logger.js → class-logger.js} +2 -2
  19. package/package.json +12 -3
  20. package/requests/add-requests.d.ts +3 -0
  21. package/requests/add-requests.js +14 -0
  22. package/requests/answer-requests.d.ts +7 -0
  23. package/requests/answer-requests.js +23 -0
  24. package/requests/approve-requests.d.ts +3 -0
  25. package/requests/approve-requests.js +7 -0
  26. package/requests/ban-requests.d.ts +4 -0
  27. package/requests/ban-requests.js +11 -0
  28. package/requests/close-requests.d.ts +4 -0
  29. package/requests/close-requests.js +11 -0
  30. package/requests/copy-requests.d.ts +4 -0
  31. package/requests/copy-requests.js +11 -0
  32. package/requests/create-requests.d.ts +7 -0
  33. package/requests/create-requests.js +30 -0
  34. package/requests/decline-requests.d.ts +3 -0
  35. package/requests/decline-requests.js +7 -0
  36. package/requests/delete-requests.d.ts +10 -0
  37. package/requests/delete-requests.js +35 -0
  38. package/requests/download-requests.d.ts +3 -0
  39. package/requests/download-requests.js +29 -0
  40. package/requests/edit-requests.d.ts +12 -0
  41. package/requests/edit-requests.js +46 -0
  42. package/requests/export-requests.d.ts +3 -0
  43. package/requests/export-requests.js +7 -0
  44. package/requests/forward-requests.d.ts +4 -0
  45. package/requests/forward-requests.js +11 -0
  46. package/requests/get-requests.d.ts +23 -0
  47. package/requests/get-requests.js +92 -0
  48. package/requests/hide-requests.d.ts +3 -0
  49. package/requests/hide-requests.js +7 -0
  50. package/requests/leave-requests.d.ts +3 -0
  51. package/requests/leave-requests.js +7 -0
  52. package/requests/log-requests.d.ts +2 -0
  53. package/requests/log-requests.js +7 -0
  54. package/requests/pin-requests.d.ts +3 -0
  55. package/requests/pin-requests.js +7 -0
  56. package/requests/promote-requests.d.ts +3 -0
  57. package/requests/promote-requests.js +7 -0
  58. package/requests/refund-requests.d.ts +3 -0
  59. package/requests/refund-requests.js +7 -0
  60. package/requests/reopen-requests.d.ts +4 -0
  61. package/requests/reopen-requests.js +11 -0
  62. package/requests/replace-requests.d.ts +3 -0
  63. package/requests/replace-requests.js +14 -0
  64. package/requests/restrict-requests.d.ts +3 -0
  65. package/requests/restrict-requests.js +7 -0
  66. package/requests/revoke-requests.d.ts +3 -0
  67. package/requests/revoke-requests.js +7 -0
  68. package/requests/send-requests.d.ts +24 -0
  69. package/requests/send-requests.js +102 -0
  70. package/requests/set-requests.d.ts +24 -0
  71. package/requests/set-requests.js +95 -0
  72. package/requests/stop-requests.d.ts +4 -0
  73. package/requests/stop-requests.js +11 -0
  74. package/requests/unban-requests.d.ts +4 -0
  75. package/requests/unban-requests.js +11 -0
  76. package/requests/unhide-requests.d.ts +3 -0
  77. package/requests/unhide-requests.js +7 -0
  78. package/requests/unpin-requests.d.ts +6 -0
  79. package/requests/unpin-requests.js +19 -0
  80. package/requests/upload-requests.d.ts +3 -0
  81. package/requests/upload-requests.js +7 -0
  82. package/requests/webhook-requests.d.ts +6 -0
  83. package/requests/webhook-requests.js +20 -0
  84. package/utils/callback-query-utils.d.ts +3 -0
  85. package/utils/callback-query-utils.js +25 -0
  86. package/utils/command-utils.d.ts +5 -0
  87. package/utils/command-utils.js +28 -0
  88. package/utils/context-utils.d.ts +11 -0
  89. package/utils/context-utils.js +42 -0
  90. package/utils/html-utils.d.ts +2 -0
  91. package/utils/html-utils.js +18 -0
  92. package/utils/inline-keyboard-utils.d.ts +12 -0
  93. package/utils/inline-keyboard-utils.js +43 -0
  94. package/utils/reply-to-message-utils.d.ts +6 -0
  95. package/utils/reply-to-message-utils.js +36 -0
  96. package/utils/start-message-utils.d.ts +6 -0
  97. package/utils/start-message-utils.js +40 -0
  98. package/builders/button.builder.d.ts +0 -11
  99. package/builders/button.builder.js +0 -31
  100. package/childs/add.d.ts +0 -6
  101. package/childs/add.js +0 -10
  102. package/childs/answer.d.ts +0 -10
  103. package/childs/answer.js +0 -22
  104. package/childs/approve.d.ts +0 -6
  105. package/childs/approve.js +0 -10
  106. package/childs/ban.d.ts +0 -7
  107. package/childs/ban.js +0 -13
  108. package/childs/close.d.ts +0 -7
  109. package/childs/close.js +0 -13
  110. package/childs/copy.d.ts +0 -7
  111. package/childs/copy.js +0 -13
  112. package/childs/create.d.ts +0 -10
  113. package/childs/create.js +0 -26
  114. package/childs/decline.d.ts +0 -6
  115. package/childs/decline.js +0 -10
  116. package/childs/delete.d.ts +0 -13
  117. package/childs/delete.js +0 -31
  118. package/childs/download.d.ts +0 -8
  119. package/childs/download.js +0 -32
  120. package/childs/edit.d.ts +0 -14
  121. package/childs/edit.js +0 -38
  122. package/childs/export.d.ts +0 -6
  123. package/childs/export.js +0 -10
  124. package/childs/forward.d.ts +0 -7
  125. package/childs/forward.js +0 -13
  126. package/childs/get.d.ts +0 -26
  127. package/childs/get.js +0 -73
  128. package/childs/hide.d.ts +0 -6
  129. package/childs/hide.js +0 -10
  130. package/childs/leave.d.ts +0 -6
  131. package/childs/leave.js +0 -10
  132. package/childs/log.d.ts +0 -5
  133. package/childs/log.js +0 -10
  134. package/childs/pin.d.ts +0 -6
  135. package/childs/pin.js +0 -10
  136. package/childs/polling.d.ts +0 -9
  137. package/childs/polling.js +0 -34
  138. package/childs/privates/send.private.d.ts +0 -8
  139. package/childs/privates/send.private.js +0 -19
  140. package/childs/promote.d.ts +0 -6
  141. package/childs/promote.js +0 -10
  142. package/childs/refund.d.ts +0 -6
  143. package/childs/refund.js +0 -14
  144. package/childs/reopen.d.ts +0 -7
  145. package/childs/reopen.js +0 -13
  146. package/childs/replace.d.ts +0 -6
  147. package/childs/replace.js +0 -10
  148. package/childs/restrict.d.ts +0 -6
  149. package/childs/restrict.js +0 -13
  150. package/childs/revoke.d.ts +0 -6
  151. package/childs/revoke.js +0 -10
  152. package/childs/send.d.ts +0 -32
  153. package/childs/send.js +0 -111
  154. package/childs/set.d.ts +0 -28
  155. package/childs/set.js +0 -82
  156. package/childs/stop.d.ts +0 -7
  157. package/childs/stop.js +0 -13
  158. package/childs/unban.d.ts +0 -7
  159. package/childs/unban.js +0 -13
  160. package/childs/unhide.d.ts +0 -6
  161. package/childs/unhide.js +0 -10
  162. package/childs/unpin.d.ts +0 -9
  163. package/childs/unpin.js +0 -23
  164. package/childs/upload.d.ts +0 -6
  165. package/childs/upload.js +0 -10
  166. package/childs/webhook.d.ts +0 -10
  167. package/childs/webhook.js +0 -28
  168. package/loggers/module.logger.d.ts +0 -2
  169. package/modules/api.d.ts +0 -5
  170. package/modules/api.js +0 -24
  171. package/modules/builder.d.ts +0 -4
  172. package/modules/builder.js +0 -8
  173. package/modules/child.d.ts +0 -5
  174. package/modules/child.js +0 -10
  175. package/modules/configuration.d.ts +0 -8
  176. package/modules/configuration.js +0 -10
  177. package/modules/dummy.d.ts +0 -9
  178. package/modules/dummy.js +0 -56
  179. package/modules/telegram.d.ts +0 -109
  180. package/modules/telegram.js +0 -391
  181. package/utils/callback.query.utils.d.ts +0 -5
  182. package/utils/callback.query.utils.js +0 -26
  183. package/utils/command.utils.d.ts +0 -7
  184. package/utils/command.utils.js +0 -29
  185. package/utils/context.utils.d.ts +0 -13
  186. package/utils/context.utils.js +0 -41
  187. package/utils/html.utils.d.ts +0 -5
  188. package/utils/html.utils.js +0 -20
  189. package/utils/inline.keyboard.utils.d.ts +0 -4
  190. package/utils/inline.keyboard.utils.js +0 -26
  191. package/utils/reply.to.message.utils.d.ts +0 -6
  192. package/utils/reply.to.message.utils.js +0 -27
  193. package/utils/start.utils.d.ts +0 -7
  194. package/utils/start.utils.js +0 -32
package/index.d.ts CHANGED
@@ -12,14 +12,16 @@ import type { BotDescription } from '@aracna/telegram-bot-types';
12
12
  import type { BotName } from '@aracna/telegram-bot-types';
13
13
  import type { BotShortDescription } from '@aracna/telegram-bot-types';
14
14
  import type { BusinessConnection } from '@aracna/telegram-bot-types';
15
+ import type { BusinessMessagesDeleted } from '@aracna/telegram-bot-types';
15
16
  import type { CallbackQuery as CallbackQuery_2 } from '@aracna/telegram-bot-types';
16
17
  import type { Chat } from '@aracna/telegram-bot-types';
17
18
  import type { ChatAdministratorRights } from '@aracna/telegram-bot-types';
19
+ import type { ChatBoostRemoved } from '@aracna/telegram-bot-types';
20
+ import type { ChatBoostUpdated } from '@aracna/telegram-bot-types';
18
21
  import type { ChatInviteLink } from '@aracna/telegram-bot-types';
19
22
  import type { ChatJoinRequest } from '@aracna/telegram-bot-types';
20
23
  import type { ChatMember } from '@aracna/telegram-bot-types';
21
24
  import type { ChatMemberUpdated } from '@aracna/telegram-bot-types';
22
- import type { ChatPermissions } from '@aracna/telegram-bot-types';
23
25
  import type { ChosenInlineResult } from '@aracna/telegram-bot-types';
24
26
  import type { CloseForumTopic } from '@aracna/telegram-bot-types';
25
27
  import type { CloseGeneralForumTopic } from '@aracna/telegram-bot-types';
@@ -52,7 +54,9 @@ import type { EditMessageReplyMarkup } from '@aracna/telegram-bot-types';
52
54
  import type { EditMessageText } from '@aracna/telegram-bot-types';
53
55
  import type { ExportChatInviteLink } from '@aracna/telegram-bot-types';
54
56
  import { FetchError } from '@aracna/core';
57
+ import type { FetchResponse } from '@aracna/core';
55
58
  import type { File as File_2 } from '@aracna/telegram-bot-types';
59
+ import type { ForumTopic } from '@aracna/telegram-bot-types';
56
60
  import type { ForwardMessage } from '@aracna/telegram-bot-types';
57
61
  import type { ForwardMessages } from '@aracna/telegram-bot-types';
58
62
  import type { GameHighScore } from '@aracna/telegram-bot-types';
@@ -78,36 +82,32 @@ import type { GetUserProfilePhotos } from '@aracna/telegram-bot-types';
78
82
  import type { HideGeneralForumTopic } from '@aracna/telegram-bot-types';
79
83
  import type { InlineKeyboardButton } from '@aracna/telegram-bot-types';
80
84
  import type { InlineQuery } from '@aracna/telegram-bot-types';
81
- import type { InlineQueryResult } from '@aracna/telegram-bot-types';
82
- import type { InputMedia } from '@aracna/telegram-bot-types';
83
85
  import type { InputMediaAudio } from '@aracna/telegram-bot-types';
84
86
  import type { InputMediaDocument } from '@aracna/telegram-bot-types';
85
87
  import type { InputMediaPhoto } from '@aracna/telegram-bot-types';
86
88
  import type { InputMediaVideo } from '@aracna/telegram-bot-types';
87
- import type { InputPollOption } from '@aracna/telegram-bot-types';
88
- import type { InputSticker } from '@aracna/telegram-bot-types';
89
- import type { LabeledPrice } from '@aracna/telegram-bot-types';
90
89
  import type { LeaveChat } from '@aracna/telegram-bot-types';
90
+ import { Logger } from '@aracna/core';
91
91
  import type { LoginUrl } from '@aracna/telegram-bot-types';
92
- import type { MaskPosition } from '@aracna/telegram-bot-types';
93
92
  import type { MenuButton } from '@aracna/telegram-bot-types';
94
93
  import type { Message } from '@aracna/telegram-bot-types';
95
94
  import type { MessageEntity } from '@aracna/telegram-bot-types';
96
95
  import type { MessageId } from '@aracna/telegram-bot-types';
97
- import type { PassportElementError } from '@aracna/telegram-bot-types';
96
+ import type { MessageReactionCountUpdated } from '@aracna/telegram-bot-types';
97
+ import type { MessageReactionUpdated } from '@aracna/telegram-bot-types';
98
98
  import type { PinChatMessage } from '@aracna/telegram-bot-types';
99
99
  import type { Poll } from '@aracna/telegram-bot-types';
100
100
  import type { PollAnswer } from '@aracna/telegram-bot-types';
101
101
  import type { PreCheckoutQuery } from '@aracna/telegram-bot-types';
102
102
  import type { PromoteChatMember } from '@aracna/telegram-bot-types';
103
- import type { ReactionType } from '@aracna/telegram-bot-types';
103
+ import { Queue } from '@aracna/core';
104
104
  import type { RefundStarPayment } from '@aracna/telegram-bot-types';
105
105
  import type { ReopenForumTopic } from '@aracna/telegram-bot-types';
106
106
  import type { ReopenGeneralForumTopic } from '@aracna/telegram-bot-types';
107
107
  import type { ReplaceStickerInSet } from '@aracna/telegram-bot-types';
108
108
  import { RequestMethod } from '@aracna/core';
109
109
  import { RestAPI } from '@aracna/core';
110
- import { RestApiConfig } from '@aracna/core';
110
+ import type { RestApiConfig } from '@aracna/core';
111
111
  import type { RestrictChatMember } from '@aracna/telegram-bot-types';
112
112
  import type { RevokeChatInviteLink } from '@aracna/telegram-bot-types';
113
113
  import type { SendAnimation } from '@aracna/telegram-bot-types';
@@ -159,6 +159,7 @@ import type { Sticker } from '@aracna/telegram-bot-types';
159
159
  import type { StickerSet } from '@aracna/telegram-bot-types';
160
160
  import type { StopMessageLiveLocation } from '@aracna/telegram-bot-types';
161
161
  import type { StopPoll } from '@aracna/telegram-bot-types';
162
+ import type { SwitchInlineQueryChosenChat } from '@aracna/telegram-bot-types';
162
163
  import type { UnbanChatMember } from '@aracna/telegram-bot-types';
163
164
  import type { UnbanChatSenderChat } from '@aracna/telegram-bot-types';
164
165
  import type { UnpinAllChatMessages } from '@aracna/telegram-bot-types';
@@ -170,534 +171,567 @@ import type { UploadStickerFile } from '@aracna/telegram-bot-types';
170
171
  import type { User } from '@aracna/telegram-bot-types';
171
172
  import type { UserChatBoosts } from '@aracna/telegram-bot-types';
172
173
  import type { UserProfilePhotos } from '@aracna/telegram-bot-types';
174
+ import type { WebAppInfo } from '@aracna/telegram-bot-types';
173
175
  import type { WebhookInfo } from '@aracna/telegram-bot-types';
174
176
 
175
- declare class Add extends Child {
176
- stickerToSet(userID: bigint, name: string, sticker: InputSticker, parameters?: Partial<AddStickerToSet>): Promise<Message | FetchError>;
177
- }
177
+ export declare function addTelegramStickerToSet(token: string, body: AddStickerToSet): Promise<boolean | FetchError>;
178
178
 
179
- declare class Answer extends Child {
180
- callbackQuery(id: string, parameters?: Partial<AnswerCallbackQuery>): Promise<boolean | FetchError>;
181
- inlineQuery(id: string, results: InlineQueryResult[], parameters?: Partial<AnswerInlineQuery>): Promise<boolean | FetchError>;
182
- preCheckoutQuery(id: string, ok: boolean, parameters?: Partial<AnswerPreCheckoutQuery>): Promise<boolean | FetchError>;
183
- shippingQuery(id: string, ok: boolean, parameters?: Partial<AnswerShippingQuery>): Promise<boolean | FetchError>;
184
- webAppQuery(id: string, result: InlineQueryResult, parameters?: Partial<AnswerWebAppQuery>): Promise<SentWebAppMessage | FetchError>;
185
- }
179
+ export declare function answerTelegramCallbackQuery(token: string, body: AnswerCallbackQuery): Promise<boolean | FetchError>;
186
180
 
187
- declare class API extends RestAPI {
188
- post<V, W, X = undefined>(path: string, body?: W, config?: RestApiConfig<void>): Promise<V | FetchError<X>>;
189
- transformBody<V>(method: RequestMethod, path: string, body: V, config: RestApiConfig<void>): Promise<FormData>;
190
- }
181
+ export declare function answerTelegramInlineQuery(token: string, body: AnswerInlineQuery): Promise<boolean | FetchError>;
191
182
 
192
- declare class Approve extends Child {
193
- chatJoinRequest(parameters: ApproveChatJoinRequest): Promise<boolean | FetchError>;
194
- }
183
+ export declare function answerTelegramPreCheckoutQuery(token: string, body: AnswerPreCheckoutQuery): Promise<boolean | FetchError>;
195
184
 
196
- declare class Ban extends Child {
197
- chatMember(parameters: BanChatMember): Promise<boolean | FetchError>;
198
- chatSenderChat(parameters: BanChatSenderChat): Promise<boolean | FetchError>;
199
- }
185
+ export declare function answerTelegramShippingQuery(token: string, body: AnswerShippingQuery): Promise<boolean | FetchError>;
186
+
187
+ export declare function answerTelegramWebAppQuery(token: string, body: AnswerWebAppQuery): Promise<SentWebAppMessage | FetchError>;
200
188
 
201
- declare class Builder {
202
- button: ButtonBuilder;
189
+ declare class API extends RestAPI<TelegramApiDefinitions.Config> {
190
+ queue: Queue;
191
+ post<V, W, X = undefined>(path: string, body: W | undefined, config: TelegramApiDefinitions.Config): Promise<V | FetchError<X>>;
192
+ transformBody<V>(method: RequestMethod, path: string, body: V, config: TelegramApiDefinitions.Config): Promise<V | FormData | undefined>;
203
193
  }
204
194
 
205
- declare class ButtonBuilder {
206
- callback<T>(text: string, data: T, type: string, chatID?: bigint): InlineKeyboardButton;
207
- game(text: string, game: string): InlineKeyboardButton;
208
- login(text: string, url: string, fields?: Partial<LoginUrl>): InlineKeyboardButton;
209
- pay(text: string): InlineKeyboardButton;
210
- query(text: string, query: string): InlineKeyboardButton;
211
- queryCurrentChat(text: string, query: string): InlineKeyboardButton;
212
- text(text: string): InlineKeyboardButton;
213
- url(text: string, url: string): InlineKeyboardButton;
195
+ declare class API_2 extends RestAPI<TelegramApiDefinitions.Config> {
196
+ get<V, W = undefined>(path: string, config: TelegramApiDefinitions.Config): Promise<V | FetchError<W>>;
214
197
  }
215
198
 
216
- export declare interface CallbackQuery<T = any> extends CallbackQuery_2 {
199
+ export declare function approveTelegramChatJoinRequest(token: string, body: ApproveChatJoinRequest): Promise<boolean | FetchError>;
200
+
201
+ export declare function banTelegramChatMember(token: string, body: BanChatMember): Promise<boolean | FetchError>;
202
+
203
+ export declare function banTelegramChatSenderChat(token: string, body: BanChatSenderChat): Promise<boolean | FetchError>;
204
+
205
+ export declare interface CallbackQuery<T = unknown> extends CallbackQuery_2 {
217
206
  body: CallbackQueryBody<T>;
218
207
  }
219
208
 
220
- export declare interface CallbackQueryBody<T = any> {
221
- c?: bigint;
209
+ export declare interface CallbackQueryBody<T = unknown> {
210
+ c?: bigint | number;
222
211
  d: T;
223
- t: string;
212
+ m?: string;
224
213
  }
225
214
 
226
- export declare class CallbackQueryUtils {
227
- static decodeBody<T>(data?: string): CallbackQueryBody<T>;
228
- static encodeBody<T>(data: T, type: string, chatID?: bigint): string;
229
- }
215
+ export declare function closeTelegramForumTopic(token: string, body: CloseForumTopic): Promise<boolean | FetchError>;
230
216
 
231
- declare class Child {
232
- protected telegram: Telegram;
233
- constructor(telegram: Telegram);
234
- }
217
+ export declare function closeTelegramGeneralForumTopic(token: string, body: CloseGeneralForumTopic): Promise<boolean | FetchError>;
235
218
 
236
- declare class Close extends Child {
237
- forumTopic(chatID: bigint, messageThreadID: number, parameters?: Partial<CloseForumTopic>): Promise<boolean | FetchError>;
238
- generalForumTopic(chatID: bigint, parameters?: Partial<CloseGeneralForumTopic>): Promise<boolean | FetchError>;
239
- }
219
+ export declare function closeTelegramWebhook(token: string): Promise<boolean | FetchError>;
240
220
 
241
- export declare class CommandUtils {
242
- static getByContext<T extends UpdateType>(context: Context_2[T]): string;
243
- static get(string?: string): string;
244
- static omit(string: string): string;
221
+ export declare interface Context {
222
+ business_connection: BusinessConnection;
223
+ business_message: Message;
224
+ callback_query: CallbackQuery;
225
+ channel_post: Message;
226
+ chat_boost: ChatBoostUpdated;
227
+ chat_join_request: ChatJoinRequest;
228
+ chat_member: ChatMemberUpdated;
229
+ chosen_inline_result: ChosenInlineResult;
230
+ deleted_business_messages: BusinessMessagesDeleted;
231
+ document: Message;
232
+ edited_business_message: Message;
233
+ edited_channel_post: Message;
234
+ edited_message: Message;
235
+ inline_query: InlineQuery;
236
+ message: Message;
237
+ message_reaction: MessageReactionUpdated;
238
+ message_reaction_count: MessageReactionCountUpdated;
239
+ my_chat_member: ChatMemberUpdated;
240
+ poll: Poll;
241
+ poll_answer: PollAnswer;
242
+ pre_checkout_query: PreCheckoutQuery;
243
+ removed_chat_boost: ChatBoostRemoved;
244
+ reply_to_message: ReplyToMessage;
245
+ shipping_query: ShippingQuery;
246
+ start: Start;
245
247
  }
246
248
 
247
- declare interface ConfigurationAPI {
248
- post: {
249
- callback: {
250
- success: <T, U>(body: T, result: U | Error) => void;
251
- };
252
- };
253
- }
249
+ export declare function copyTelegramMessage(token: string, body: CopyMessage): Promise<MessageId | FetchError>;
254
250
 
255
- declare class ConfigurationBuilder {
256
- api: ConfigurationAPI;
257
- default: ConfigurationDefault;
258
- handler: ConfigurationHandler;
259
- }
251
+ export declare function copyTelegramMessages(token: string, body: CopyMessages): Promise<MessageId[] | FetchError>;
260
252
 
261
- declare interface ConfigurationDefault {
262
- buttons: {
263
- text: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
264
- url: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
265
- login: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
266
- callback: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
267
- query: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
268
- queryCurrentChat: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
269
- game: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
270
- pay: (chatID: bigint) => Promise<InlineKeyboardButton[]>;
271
- };
272
- }
253
+ export declare function createTelegramChatInviteLink(token: string, body: CreateChatInviteLink): Promise<ChatInviteLink | FetchError>;
273
254
 
274
- declare interface ConfigurationHandler {
275
- send: {
276
- buttons: {
277
- empty: (chatID: bigint) => Error;
278
- };
279
- };
280
- }
255
+ export declare function createTelegramChatSubscriptionInviteLink(token: string, body: CreateChatSubscriptionInviteLink): Promise<ChatInviteLink | FetchError>;
281
256
 
282
- export declare interface Context {
283
- [UpdateType.CALLBACK_QUERY]: CallbackQuery;
284
- [UpdateType.CHANNEL_POST]: Message;
285
- [UpdateType.CHAT_JOIN_REQUEST]: ChatJoinRequest;
286
- [UpdateType.CHAT_MEMBER]: ChatMemberUpdated;
287
- [UpdateType.CHOSEN_INLINE_RESULT]: ChosenInlineResult;
288
- [UpdateType.DOCUMENT]: Message;
289
- [UpdateType.EDITED_CHANNEL_POST]: Message;
290
- [UpdateType.EDITED_MESSAGE]: Message;
291
- [UpdateType.INLINE_QUERY]: InlineQuery;
292
- [UpdateType.MESSAGE]: Message;
293
- [UpdateType.MY_CHAT_MEMBER]: ChatMemberUpdated;
294
- [UpdateType.POLL]: Poll;
295
- [UpdateType.POLL_ANSWER]: PollAnswer;
296
- [UpdateType.PRE_CHECKOUT_QUERY]: PreCheckoutQuery;
297
- [UpdateType.REPLY_TO_MESSAGE]: ReplyToMessage;
298
- [UpdateType.SHIPPING_QUERY]: ShippingQuery;
299
- [UpdateType.START]: Start;
300
- }
257
+ export declare function createTelegramForumTopic(token: string, body: CreateForumTopic): Promise<ForumTopic | FetchError>;
301
258
 
302
- export declare class ContextUtils {
303
- static getChatID<T extends UpdateType>(context: Context[T]): bigint;
304
- static getChatType<T extends UpdateType>(context: Context[T]): string;
305
- static getChat<T extends UpdateType>(context: Context[T]): Chat;
306
- static getUserID<T extends UpdateType>(context: Context[T]): bigint;
307
- static getUserFirstName<T extends UpdateType>(context: Context[T]): string;
308
- static getUserLastName<T extends UpdateType>(context: Context[T]): string;
309
- static getUserUsername<T extends UpdateType>(context: Context[T]): string;
310
- static getUser<T extends UpdateType>(context: Context[T]): User;
311
- }
259
+ export declare function createTelegramInvoiceLink(token: string, body: CreateInvoiceLink): Promise<string | FetchError>;
312
260
 
313
- declare class Copy extends Child {
314
- message(messageID: number, parameters: Omit<CopyMessage, 'message_id'>): Promise<MessageId | FetchError>;
315
- messages(messageIDs: number[], parameters: Omit<CopyMessages, 'message_ids'>): Promise<MessageId[] | FetchError>;
316
- }
261
+ export declare function createTelegramNewStickerSet(token: string, body: CreateNewStickerSet): Promise<boolean | FetchError>;
317
262
 
318
- declare class Create extends Child {
319
- chatInviteLink(chatID: bigint, parameters?: Partial<CreateChatInviteLink>): Promise<ChatInviteLink | FetchError>;
320
- chatSubscriptionInviteLink(chatID: bigint, parameters: Omit<CreateChatSubscriptionInviteLink, 'chat_id'>): Promise<ChatInviteLink | FetchError>;
321
- forumTopic(chatID: bigint, name: string, parameters?: Partial<CreateForumTopic>): Promise<boolean | FetchError<undefined>>;
322
- invoiceLink(prices: LabeledPrice[], parameters: Omit<CreateInvoiceLink, 'prices'>): Promise<string | FetchError>;
323
- stickerSet(userID: bigint, stickers: InputSticker[], parameters: Omit<CreateNewStickerSet, 'stickers' | 'user_id'>): Promise<boolean | FetchError>;
324
- }
263
+ export declare function declineTelegramChatJoinRequest(token: string, body: DeclineChatJoinRequest): Promise<boolean | FetchError>;
325
264
 
326
- declare class Decline extends Child {
327
- chatJoinRequest(parameters: DeclineChatJoinRequest): Promise<boolean | FetchError>;
328
- }
265
+ export declare function decodeTelegramCallbackQueryBody<T>(data?: string): CallbackQueryBody<T>;
329
266
 
330
- declare class Delete extends Child {
331
- chatPhoto(chatID: bigint, parameters?: Partial<DeleteChatPhoto>): Promise<boolean | FetchError>;
332
- chatStickerSet(chatID: bigint, parameters?: Partial<DeleteChatStickerSet>): Promise<boolean | FetchError>;
333
- commands(parameters?: Partial<DeleteMyCommands>): Promise<boolean | FetchError>;
334
- forumTopic(chatID: bigint, messageThreadID: number, parameters?: Partial<DeleteForumTopic>): Promise<boolean | FetchError>;
335
- message(chatID: bigint, messageID: number, parameters?: Partial<DeleteMessage>): Promise<boolean | FetchError>;
336
- messages(chatID: bigint, messageIDs: number[], parameters?: Partial<DeleteMessages>): Promise<boolean | FetchError>;
337
- stickerFromSet(sticker: string, parameters?: Partial<DeleteStickerFromSet>): Promise<boolean | FetchError>;
338
- stickerSet(name: string, parameters?: Partial<DeleteStickerSet>): Promise<boolean | FetchError>;
339
- }
267
+ export declare function decodeTelegramReplyToMessageBody<T>(entities: MessageEntity[]): ReplyToMessageBody<T>;
340
268
 
341
- declare class Download extends Child {
342
- api: API;
343
- file(id: string): Promise<Buffer | FetchError>;
344
- userFirstProfilePhoto(id: bigint): Promise<Buffer | FetchError | Error>;
345
- }
269
+ export declare function decodeTelegramStartBody<T>(text: string | undefined): StartBody<T>;
346
270
 
347
- declare class Edit extends Child {
348
- chatInviteLink(chatID: bigint, inviteLink: string, parameters?: Partial<EditChatInviteLink>): Promise<ChatInviteLink | FetchError>;
349
- chatSubscriptionInviteLInk(chatID: bigint, inviteLink: string, parameters?: Partial<EditChatSubscriptionInviteLink>): Promise<ChatInviteLink | FetchError>;
350
- forumTopic(chatID: bigint, messageThreadID: number, parameters?: Partial<EditForumTopic>): Promise<boolean | FetchError>;
351
- generalForumTopic(chatID: bigint, name: string, parameters?: Partial<EditGeneralForumTopic>): Promise<boolean | FetchError>;
352
- messageCaption(parameters: EditMessageCaption): Promise<Message | FetchError>;
353
- messageLiveLocation(parameters: EditMessageLiveLocation): Promise<Message | FetchError>;
354
- messageMedia(media: InputMedia, parameters?: Partial<EditMessageMedia>): Promise<Message | FetchError>;
355
- messageReplyMarkup(parameters: EditMessageReplyMarkup): Promise<Message | FetchError>;
356
- messageText(text: string, parameters?: Partial<EditMessageText>): Promise<Message | FetchError>;
357
- }
271
+ export declare const DEFAULT_TELEGRAM_ALLOWED_UPDATES: string[];
358
272
 
359
- declare class Export extends Child {
360
- chatInviteLink(chatID: bigint, parameters?: Partial<ExportChatInviteLink>): Promise<string | FetchError>;
361
- }
273
+ export declare const DEFAULT_TELEGRAM_CALLBACK_QUERY_BODY: () => CallbackQueryBody<any>;
362
274
 
363
- declare class Forward extends Child {
364
- message(messageID: number, parameters: Omit<ForwardMessage, 'message_id'>): Promise<Message | FetchError>;
365
- messages(messageIDs: number[], parameters: Omit<ForwardMessages, 'message_ids'>): Promise<MessageId[] | FetchError>;
366
- }
275
+ export declare const DEFAULT_TELEGRAM_CLIENT_LISTENER_OPTIONS: () => TelegramClientListenerOptions;
367
276
 
368
- declare class Get extends Child {
369
- businessConnection(businessConnectionID: string, parameters?: Partial<GetBusinessConnection>): Promise<BusinessConnection | FetchError>;
370
- chat(chatID: bigint, parameters?: Partial<GetChat>): Promise<Chat | FetchError>;
371
- chatAdministrators(chatID: bigint, parameters?: Partial<GetChatAdministrators>): Promise<ChatMember[] | FetchError>;
372
- chatMember(parameters: GetChatMember): Promise<ChatMember | FetchError>;
373
- chatMemberCount(chatID: bigint, parameters?: Partial<GetChatMemberCount>): Promise<bigint | FetchError>;
374
- chatMenuButton(chatID: bigint, parameters?: Partial<GetChatMenuButton>): Promise<MenuButton | FetchError>;
375
- commands(parameters?: Partial<GetMyCommands>): Promise<BotCommand[] | FetchError>;
376
- customEmojiStickers(customEmojiIDs: string[], parameters?: Partial<GetCustomEmojiStickers>): Promise<Sticker[] | FetchError>;
377
- defaultAdministratorRights(parameters?: Partial<GetMyDefaultAdministratorRights>): Promise<ChatAdministratorRights | FetchError>;
378
- description(parameters?: Partial<GetMyDescription>): Promise<BotDescription | FetchError>;
379
- file(fileID: string, parameters?: Partial<GetFile>): Promise<File_2 | FetchError>;
380
- forumTopicIconStickers(): Promise<Sticker[] | FetchError>;
381
- gameHighScores(userID: bigint, parameters?: Partial<GetGameHighScores>): Promise<GameHighScore | FetchError>;
382
- me(): Promise<User | FetchError>;
383
- name(parameters?: Partial<GetMyName>): Promise<BotName | FetchError>;
384
- shortDescription(parameters?: Partial<GetMyShortDescription>): Promise<BotShortDescription | FetchError>;
385
- starTransactions(parameters?: Partial<GetStarTransactions>): Promise<StarTransactions | FetchError>;
386
- stickerSet(name: string, parameters?: Partial<GetStickerSet>): Promise<StickerSet | FetchError>;
387
- updates(parameters?: Partial<GetUpdates>): Promise<Update[] | FetchError>;
388
- userChatBoosts(parameters: GetUserChatBoosts): Promise<UserChatBoosts | FetchError>;
389
- userProfilePhotos(userID: bigint, parameters?: Partial<GetUserProfilePhotos>): Promise<UserProfilePhotos | FetchError>;
390
- }
277
+ export declare const DEFAULT_TELEGRAM_CLIENT_POLLING_MS: number;
391
278
 
392
- export declare interface Handler<T extends UpdateType = any, U extends HandlerOptions = HandlerOptions> {
393
- description?: string;
394
- id: string;
395
- key?: string;
396
- middleware: HandlerMiddleware<T>;
397
- options: U;
398
- type: UpdateType;
399
- }
279
+ export declare const DEFAULT_TELEGRAM_REPLY_TO_MESSAGE_BODY: () => ReplyToMessageBody<any>;
400
280
 
401
- export declare type HandlerMiddleware<T extends UpdateType> = (context: Context[T]) => any;
281
+ export declare const DEFAULT_TELEGRAM_START_MESSAGE_BODY: () => StartBody<any>;
402
282
 
403
- export declare interface HandlerOptions {
404
- deleteOnCallbackQuery?: boolean;
405
- deleteOnReply?: boolean;
406
- deleteOnMessageStart?: boolean;
283
+ export declare function deleteTelegramChatPhoto(token: string, body: DeleteChatPhoto): Promise<boolean | FetchError>;
284
+
285
+ export declare function deleteTelegramChatStickerSet(token: string, body: DeleteChatStickerSet): Promise<boolean | FetchError>;
286
+
287
+ export declare function deleteTelegramCommands(token: string, body?: DeleteMyCommands): Promise<boolean | FetchError>;
288
+
289
+ export declare function deleteTelegramForumTopic(token: string, body: DeleteForumTopic): Promise<boolean | FetchError>;
290
+
291
+ export declare function deleteTelegramMessage(token: string, body: DeleteMessage): Promise<boolean | FetchError>;
292
+
293
+ export declare function deleteTelegramMessages(token: string, body: DeleteMessages): Promise<boolean | FetchError>;
294
+
295
+ export declare function deleteTelegramStickerFromSet(token: string, body: DeleteStickerFromSet): Promise<boolean | FetchError>;
296
+
297
+ export declare function deleteTelegramStickerSet(token: string, body: DeleteStickerSet): Promise<boolean | FetchError>;
298
+
299
+ export declare function deleteTelegramWebhook(token: string, body?: DeleteWebhook): Promise<boolean | FetchError>;
300
+
301
+ export declare function downloadTelegramFile(token: string, fileID: string): Promise<Blob | FetchError>;
302
+
303
+ export declare function downloadTelegramUserFirstProfilePhoto(token: string, userID: bigint | number): Promise<Blob | FetchError | Error>;
304
+
305
+ export declare interface EditMessageMediaAlternative extends Omit<EditMessageMedia, 'media'> {
306
+ media: InputMediaAlternative;
407
307
  }
408
308
 
409
- declare class Hide extends Child {
410
- generalForumTopic(chatID: bigint, parameters?: Partial<HideGeneralForumTopic>): Promise<boolean | FetchError>;
309
+ export declare function editTelegramChatInviteLink(token: string, body: EditChatInviteLink): Promise<ChatInviteLink | FetchError>;
310
+
311
+ export declare function editTelegramChatSubscriptionInviteLink(token: string, body: EditChatSubscriptionInviteLink): Promise<ChatInviteLink | FetchError>;
312
+
313
+ export declare function editTelegramForumTopic(token: string, body: EditForumTopic): Promise<boolean | FetchError>;
314
+
315
+ export declare function editTelegramGeneralForumTopic(token: string, body: EditGeneralForumTopic): Promise<boolean | FetchError>;
316
+
317
+ export declare function editTelegramMessageCaption(token: string, body: EditMessageCaption): Promise<Message | FetchError>;
318
+
319
+ export declare function editTelegramMessageLiveLocation(token: string, body: EditMessageLiveLocation): Promise<Message | FetchError>;
320
+
321
+ export declare function editTelegramMessageMedia(token: string, body: EditMessageMediaAlternative): Promise<Message | FetchError>;
322
+
323
+ export declare function editTelegramMessageReplyMarkup(token: string, body: EditMessageReplyMarkup): Promise<Message | FetchError>;
324
+
325
+ export declare function editTelegramMessageText(token: string, body: EditMessageText): Promise<Message | FetchError>;
326
+
327
+ export declare function encodeTelegramCallbackQueryBody<T>(data: T, options?: EncodeTelegramCallbackQueryBodyOptions): string;
328
+
329
+ export declare interface EncodeTelegramCallbackQueryBodyOptions {
330
+ chatID?: bigint | number;
331
+ command?: string;
411
332
  }
412
333
 
413
- export declare class HTMLUtils {
414
- static tags: string[];
415
- static sanitize(text: string): string;
416
- static progress(value: number, min?: number, max?: number, size?: number): string;
334
+ export declare function encodeTelegramReplyToMessageBody<T>(data: T, options?: EncodeTelegramReplyToMessageBodyOptions): string;
335
+
336
+ export declare interface EncodeTelegramReplyToMessageBodyOptions {
337
+ chatID?: bigint | number;
338
+ command?: string;
417
339
  }
418
340
 
419
- export declare class InlineKeyboardUtils {
420
- static getButtonsType(buttons: InlineKeyboardButton[]): string;
341
+ export declare function encodeTelegramReplyToMessageBodyToAnchorTag<T>(data: T, options?: EncodeTelegramReplyToMessageBodyOptions): string;
342
+
343
+ export declare function encodeTelegramReplyToMessageBodyToURL<T>(data: T, options?: EncodeTelegramReplyToMessageBodyOptions): string;
344
+
345
+ export declare function encodeTelegramStartBody<T>(data: T, options?: EncodeTelegramStartBodyOptions): string;
346
+
347
+ export declare interface EncodeTelegramStartBodyOptions {
348
+ chatID?: bigint | number;
349
+ command?: string;
421
350
  }
422
351
 
352
+ export declare function encodeTelegramStartBodyToAnchorTag<T>(username: string, children: string, data: T, options?: EncodeTelegramStartBodyOptions): string;
353
+
354
+ export declare function encodeTelegramStartBodyToText<T>(data: T, options?: EncodeTelegramStartBodyOptions): string;
355
+
356
+ export declare function encodeTelegramStartBodyToURL<T>(username: string, data: T, options?: EncodeTelegramStartBodyOptions): string;
357
+
358
+ export declare function exportTelegramChatInviteLink(token: string, body: ExportChatInviteLink): Promise<string | FetchError>;
359
+
360
+ export declare function forwardTelegramMessage(token: string, body: ForwardMessage): Promise<Message | FetchError>;
361
+
362
+ export declare function forwardTelegramMessages(token: string, body: ForwardMessages): Promise<MessageId[] | FetchError>;
363
+
364
+ export declare function getMyTelegramCommands(token: string, body?: GetMyCommands): Promise<BotCommand[] | FetchError>;
365
+
366
+ export declare function getMyTelegramDefaultAdministratorRights(token: string, body?: GetMyDefaultAdministratorRights): Promise<ChatAdministratorRights | FetchError>;
367
+
368
+ export declare function getMyTelegramDescription(token: string, body?: GetMyDescription): Promise<BotDescription | FetchError>;
369
+
370
+ export declare function getMyTelegramName(token: string, body?: GetMyName): Promise<BotName | FetchError>;
371
+
372
+ export declare function getMyTelegramShortDescription(token: string, body?: GetMyShortDescription): Promise<BotShortDescription | FetchError>;
373
+
374
+ export declare function getTelegramBusinessConnection(token: string, body: GetBusinessConnection): Promise<BusinessConnection | FetchError>;
375
+
376
+ export declare function getTelegramChat(token: string, body: GetChat): Promise<Chat | FetchError>;
377
+
378
+ export declare function getTelegramChatAdministrators(token: string, body: GetChatAdministrators): Promise<ChatMember[] | FetchError>;
379
+
380
+ export declare function getTelegramChatMember(token: string, body: GetChatMember): Promise<ChatMember | FetchError>;
381
+
382
+ export declare function getTelegramChatMemberCount(token: string, body: GetChatMemberCount): Promise<number | FetchError>;
383
+
384
+ export declare function getTelegramChatMenuButton(token: string, body: GetChatMenuButton): Promise<MenuButton | FetchError>;
385
+
386
+ export declare function getTelegramCommand(string: string | undefined): string | undefined;
387
+
388
+ export declare function getTelegramCommandByContext<T extends UpdateType>(context: Context_2[T]): string | undefined;
389
+
390
+ export declare function getTelegramContextChat<T extends UpdateType>(context: Context[T]): Chat | undefined;
391
+
392
+ export declare function getTelegramContextChatID<T extends UpdateType>(context: Context[T]): bigint | number | undefined;
393
+
394
+ export declare function getTelegramContextChatType<T extends UpdateType>(context: Context[T]): string | undefined;
395
+
396
+ export declare function getTelegramContextUser<T extends UpdateType>(context: Context[T]): User | undefined;
397
+
398
+ export declare function getTelegramContextUserFirstName<T extends UpdateType>(context: Context[T]): string | undefined;
399
+
400
+ export declare function getTelegramContextUserID<T extends UpdateType>(context: Context[T]): bigint | number | undefined;
401
+
402
+ export declare function getTelegramContextUserLastName<T extends UpdateType>(context: Context[T]): string | undefined;
403
+
404
+ export declare function getTelegramContextUserUsername<T extends UpdateType>(context: Context[T]): string | undefined;
405
+
406
+ export declare function getTelegramCustomEmojiStickers(token: string, body: GetCustomEmojiStickers): Promise<Sticker[] | FetchError>;
407
+
408
+ export declare function getTelegramFile(token: string, body: GetFile): Promise<File_2 | FetchError>;
409
+
410
+ export declare function getTelegramForumTopicIconStickers(token: string): Promise<Sticker[] | FetchError>;
411
+
412
+ export declare function getTelegramGameHighScores(token: string, body: GetGameHighScores): Promise<GameHighScore[] | FetchError>;
413
+
414
+ export declare function getTelegramInlineKeyboardCallbackButton<T>(text: string, data: T, options?: EncodeTelegramCallbackQueryBodyOptions): InlineKeyboardButton;
415
+
416
+ export declare function getTelegramInlineKeyboardGameButton(text: string, game: string): InlineKeyboardButton;
417
+
418
+ export declare function getTelegramInlineKeyboardLoginButton(text: string, url: string, fields?: Partial<LoginUrl>): InlineKeyboardButton;
419
+
420
+ export declare function getTelegramInlineKeyboardPayButton(text: string): InlineKeyboardButton;
421
+
422
+ export declare function getTelegramInlineKeyboardQueryButton(text: string, query: string): InlineKeyboardButton;
423
+
424
+ export declare function getTelegramInlineKeyboardQueryChosenChatButton(text: string, query: SwitchInlineQueryChosenChat): InlineKeyboardButton;
425
+
426
+ export declare function getTelegramInlineKeyboardQueryCurrentChatButton(text: string, query: string): InlineKeyboardButton;
427
+
428
+ export declare function getTelegramInlineKeyboardTextButton(text: string): InlineKeyboardButton;
429
+
430
+ export declare function getTelegramInlineKeyboardUrlButton(text: string, url: string): InlineKeyboardButton;
431
+
432
+ export declare function getTelegramInlineKeyboardWebAppButton(text: string, app: WebAppInfo): InlineKeyboardButton;
433
+
434
+ export declare function getTelegramMe(token: string): Promise<User | FetchError>;
435
+
436
+ export declare function getTelegramProgressHTML(value: number, min?: number, max?: number, size?: number): string;
437
+
438
+ export declare function getTelegramStarTransactions(token: string, body?: GetStarTransactions): Promise<StarTransactions | FetchError>;
439
+
440
+ export declare function getTelegramStickerSet(token: string, body: GetStickerSet): Promise<StickerSet | FetchError>;
441
+
442
+ export declare function getTelegramUpdates(token: string, body?: GetUpdates): Promise<Update[] | FetchError>;
443
+
444
+ export declare function getTelegramUserChatBoosts(token: string, body: GetUserChatBoosts): Promise<UserChatBoosts | FetchError>;
445
+
446
+ export declare function getTelegramUserProfilePhotos(token: string, body: GetUserProfilePhotos): Promise<UserProfilePhotos | FetchError>;
447
+
448
+ export declare function getTelegramWebhookInfo(token: string): Promise<WebhookInfo | FetchError>;
449
+
450
+ export declare function hideTelegramGeneralForumTopic(token: string, body: HideGeneralForumTopic): Promise<boolean | FetchError>;
451
+
423
452
  export declare type InputFile = File | string;
424
453
 
425
- declare interface InputMediaAlternative extends Omit<InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo, 'media'> {
454
+ export declare interface InputMediaAlternative extends Omit<InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo, 'media'> {
426
455
  media: InputFile;
427
456
  }
428
457
 
429
- declare interface InputPaidMediaAlternative extends Omit<InputMediaPhoto | InputMediaVideo, 'media'> {
458
+ export declare interface InputPaidMediaAlternative extends Omit<InputMediaPhoto | InputMediaVideo, 'media'> {
430
459
  media: InputFile;
431
460
  }
432
461
 
433
- declare class Leave extends Child {
434
- chat(chatID: bigint, parameters?: Partial<LeaveChat>): Promise<boolean | FetchError>;
435
- }
462
+ export declare function leaveTelegramChat(token: string, body: LeaveChat): Promise<boolean | FetchError>;
436
463
 
437
- declare class Log extends Child {
438
- out(): Promise<boolean | FetchError>;
439
- }
464
+ export declare function logOutTelegram(token: string): Promise<boolean | FetchError>;
440
465
 
441
- export declare interface MessageBody<T = any> {
442
- chatID?: bigint;
443
- data: T;
444
- type: string;
445
- }
466
+ export declare function omitTelegramCommand(string: string | undefined): string;
446
467
 
447
- declare class Pin extends Child {
448
- chatMessage(chatID: bigint, messageID: number, parameters?: Partial<PinChatMessage>): Promise<boolean | FetchError>;
449
- }
468
+ export declare function pinTelegramChatMessage(token: string, body: PinChatMessage): Promise<boolean | FetchError>;
450
469
 
451
- declare class Polling extends Child {
452
- active: boolean;
453
- offset: number;
454
- start(ms?: number, parameters?: Partial<GetUpdates>): void;
455
- stop(): void;
456
- private get;
457
- }
470
+ export declare function promoteTelegramChatMember(token: string, body: PromoteChatMember): Promise<boolean | FetchError>;
458
471
 
459
- declare class Promote extends Child {
460
- chatMember(parameters: PromoteChatMember): Promise<boolean | FetchError>;
461
- }
472
+ export declare function refundTelegramStarPayment(token: string, body: RefundStarPayment): Promise<boolean | FetchError>;
462
473
 
463
- declare class Refund extends Child {
464
- starPayment(userID: bigint, telegramPaymentChargeID: string, parameters?: Partial<RefundStarPayment>): Promise<boolean | FetchError>;
465
- }
474
+ export declare const REGEXP_TELEGRAM_COMMAND: RegExp;
466
475
 
467
- declare class Reopen extends Child {
468
- forumTopic(chatID: bigint, messageThreadID: number, parameters?: Partial<ReopenForumTopic>): Promise<boolean | FetchError>;
469
- generalForumTopic(chatID: bigint, parameters?: Partial<ReopenGeneralForumTopic>): Promise<boolean | FetchError>;
470
- }
476
+ export declare const REGEXP_TELEGRAM_COMMAND_WITH_USERNAME: RegExp;
471
477
 
472
- declare class Replace extends Child {
473
- stickerInSet(userID: bigint, sticker: InputSticker, parameters: Omit<ReplaceStickerInSet, 'sticker' | 'user_id'>): Promise<boolean | FetchError>;
474
- }
478
+ export declare function reopenTelegramForumTopic(token: string, body: ReopenForumTopic): Promise<boolean | FetchError>;
475
479
 
476
- export declare interface ReplyToMessage<T = any> extends Message {
477
- body: MessageBody<T>;
478
- }
480
+ export declare function reopenTelegramGeneralForumTopic(token: string, body: ReopenGeneralForumTopic): Promise<boolean | FetchError>;
479
481
 
480
- export declare class ReplyToMessageUtils {
481
- static decodeBody<T>(entities: MessageEntity[]): MessageBody<T>;
482
- static encodeBody<T>(data: T, type: string, chatID?: bigint): string;
483
- }
482
+ export declare function replaceTelegramStickerInSet(token: string, body: ReplaceStickerInSet): Promise<boolean | FetchError>;
484
483
 
485
- declare class Restrict extends Child {
486
- chatMember(permissions: ChatPermissions, parameters: Omit<RestrictChatMember, 'permissions'>): Promise<boolean | FetchError>;
484
+ export declare interface ReplyToMessage<T = unknown> extends Message {
485
+ body: ReplyToMessageBody<T>;
487
486
  }
488
487
 
489
- declare class Revoke extends Child {
490
- chatInviteLink(chatID: bigint, inviteLink: string, parameters?: Partial<RevokeChatInviteLink>): Promise<ChatInviteLink | FetchError>;
488
+ export declare interface ReplyToMessageBody<T = unknown> {
489
+ c?: bigint | number;
490
+ d: T;
491
+ m?: string;
491
492
  }
492
493
 
493
- declare class Send extends Child {
494
- private: SendPrivate;
495
- animation(chatID: bigint, file: InputFile, parameters?: Partial<SendAnimation>): Promise<Message | FetchError>;
496
- audio(chatID: bigint, file: InputFile, parameters?: Partial<SendAudio>): Promise<Message | FetchError>;
497
- document(chatID: bigint, file: InputFile, parameters?: Partial<SendDocument>): Promise<Message | FetchError>;
498
- buttons(chatID: bigint, text: string, buttons: InlineKeyboardButton[], parameters?: Partial<SendMessage>): Promise<Message | FetchError | Error>;
499
- chatAction(chatID: bigint, action: string, parameters?: Partial<SendChatAction>): Promise<boolean | FetchError>;
500
- contact(chatID: bigint, parameters: Omit<SendContact, 'chat_id'>): Promise<Message | FetchError>;
501
- dice(chatID: bigint, parameters?: Partial<SendDice>): Promise<Message | FetchError>;
502
- game(chatID: bigint, gameShortName: string, parameters?: Partial<SendGame>): Promise<Message | FetchError>;
503
- html(chatID: bigint, text: string, parameters?: Partial<SendMessage>): Promise<Message | FetchError>;
504
- invoice(chatID: bigint, prices: LabeledPrice[], parameters: Omit<SendInvoice, 'chat_id' | 'prices'>): Promise<Message | FetchError>;
505
- location(chatID: bigint, parameters: Omit<SendLocation, 'chat_id'>): Promise<Message | FetchError>;
506
- mediaGroup(chatID: bigint, media: InputMediaAlternative[], parameters?: Partial<SendMediaGroup>): Promise<Message | FetchError>;
507
- message(chatID: bigint, text: string, parameters?: Partial<SendMessage>): Promise<Message | FetchError>;
508
- paidMedia(chatID: bigint, media: InputPaidMediaAlternative[], stars: number, parameters?: Partial<SendPaidMedia>): Promise<Message | FetchError>;
509
- photo(chatID: bigint, file: InputFile, parameters?: Partial<SendPhoto>): Promise<Message | FetchError>;
510
- poll(chatID: bigint, question: string, options: InputPollOption[], parameters?: Partial<SendPoll>): Promise<Message | FetchError>;
511
- repliable<T>(chatID: bigint, data: T, parameters: Omit<SendRepliable, 'chat_id' | 'data'>): Promise<Message | FetchError>;
512
- sticker(chatID: bigint, file: InputFile, parameters?: Partial<SendSticker>): Promise<Message | FetchError>;
513
- venue(chatID: bigint, parameters: Omit<SendVenue, 'chat_id'>): Promise<Message | FetchError>;
514
- video(chatID: bigint, file: InputFile, parameters?: Partial<SendVideo>): Promise<Message | FetchError>;
515
- videoNote(chatID: bigint, file: InputFile, parameters?: Partial<SendVideoNote>): Promise<Message | FetchError>;
516
- voice(chatID: bigint, file: InputFile, parameters?: Partial<SendVoice>): Promise<Message | FetchError>;
517
- private file;
494
+ export declare function restrictTelegramChatMember(token: string, body: RestrictChatMember): Promise<boolean | FetchError>;
495
+
496
+ export declare function revokeTelegramChatInviteLink(token: string, body: RevokeChatInviteLink): Promise<ChatInviteLink | FetchError>;
497
+
498
+ export declare function sanitizeTelegramHTML(text: string): string;
499
+
500
+ declare interface SendMediaGroupAlternative extends Omit<SendMediaGroup, 'media'> {
501
+ media: InputMediaAlternative[];
518
502
  }
519
503
 
520
- declare class SendPrivate extends Child {
521
- buttons(chatIDs: [bigint, bigint], text: string, buttons: InlineKeyboardButton[], parameters?: Partial<SendMessage>): Promise<Message | FetchError | Error>;
522
- repliable<T>(chatIDs: [bigint, bigint], data: T, parameters: Omit<SendRepliable, 'chat_id' | 'data' | 'from_chat_id'>): Promise<Message | FetchError | Error>;
504
+ declare interface SendPaidMediaAlternative extends Omit<SendPaidMedia, 'media'> {
505
+ media: InputPaidMediaAlternative[];
523
506
  }
524
507
 
525
- declare interface SendRepliable<T = any> extends SendMessage {
508
+ export declare interface SendRepliableMessage<T = unknown> extends SendMessage {
509
+ command?: string;
526
510
  data: T;
527
511
  from_chat_id?: bigint;
528
- text: string;
529
- type: string;
530
512
  }
531
513
 
532
- declare class Set_2 extends Child {
533
- chatAdministratorCustomTitle(customTitle: string, parameters: Omit<SetChatAdministratorCustomTitle, 'custom_title'>): Promise<boolean | FetchError>;
534
- chatDescription(chatID: bigint, description?: string, parameters?: Partial<SetChatDescription>): Promise<boolean | FetchError>;
535
- chatMenuButton(chatID: bigint, menuButton?: MenuButton, parameters?: Partial<SetChatMenuButton>): Promise<boolean | FetchError>;
536
- chatPermissions(chatID: bigint, permissions: ChatPermissions, parameters?: Partial<SetChatPermissions>): Promise<boolean | FetchError>;
537
- chatPhoto(chatID: bigint, photo: InputFile, parameters?: Partial<SetChatPhoto>): Promise<boolean | FetchError>;
538
- chatStickerSet(chatID: bigint, stickerSetName: string, parameters?: Partial<SetChatStickerSet>): Promise<boolean | FetchError>;
539
- chatTitle(chatID: bigint, title: string, parameters?: Partial<SetChatTitle>): Promise<boolean | FetchError>;
540
- commands(commands: BotCommand[], parameters?: Partial<SetMyCommands>): Promise<boolean | FetchError>;
541
- customEmojiStickerSetThumbnail(name: string, customEmojiID?: string, parameters?: Partial<SetCustomEmojiStickerSetThumbnail>): Promise<boolean | FetchError>;
542
- defaultAdministratorRights(rights: ChatAdministratorRights, parameters?: Partial<SetMyDefaultAdministratorRights>): Promise<boolean | FetchError>;
543
- description(description?: string, parameters?: Partial<SetMyDescription>): Promise<boolean | FetchError>;
544
- gameScore(userID: bigint, score: number, parameters?: Partial<SetGameScore>): Promise<boolean | FetchError>;
545
- messageReaction(chatID: bigint, messageID: number, reaction: ReactionType[], parameters?: Partial<SetMessageReaction>): Promise<boolean | FetchError>;
546
- name(name?: string, parameters?: Partial<SetMyName>): Promise<boolean | FetchError>;
547
- passportDataErrors(userID: bigint, errors: PassportElementError[], parameters?: Partial<SetPassportDataErrors>): Promise<boolean | FetchError>;
548
- shortDescription(shortDescription?: string, parameters?: Partial<SetMyShortDescription>): Promise<boolean | FetchError>;
549
- stickerEmojiList(sticker: string, emojis: string[], parameters?: Partial<SetStickerEmojiList>): Promise<boolean | FetchError>;
550
- stickerKeywords(sticker: string, keywords?: string[], parameters?: Partial<SetStickerKeywords>): Promise<boolean | FetchError>;
551
- stickerMaskPosition(sticker: string, maskPosition?: MaskPosition, parameters?: Partial<SetStickerMaskPosition>): Promise<boolean | FetchError>;
552
- stickerPositionInSet(sticker: string, position: number, parameters?: Partial<SetStickerPositionInSet>): Promise<boolean | FetchError>;
553
- stickerSetThumbnail(userID: bigint, parameters: Omit<SetStickerSetThumbnail, 'user_id'>): Promise<boolean | FetchError>;
554
- stickerSetTitle(name: string, title: string, parameters?: Partial<SetStickerSetTitle>): Promise<boolean | FetchError>;
555
- }
514
+ export declare function sendTelegramAnimation(token: string, body: SendAnimation): Promise<Message | FetchError>;
515
+
516
+ export declare function sendTelegramAudio(token: string, body: SendAudio): Promise<Message | FetchError>;
517
+
518
+ export declare function sendTelegramChatAction(token: string, body: SendChatAction): Promise<boolean | FetchError>;
519
+
520
+ export declare function sendTelegramContact(token: string, body: SendContact): Promise<Message | FetchError>;
521
+
522
+ export declare function sendTelegramDice(token: string, body: SendDice): Promise<Message | FetchError>;
523
+
524
+ export declare function sendTelegramDocument(token: string, body: SendDocument): Promise<Message | FetchError>;
525
+
526
+ export declare function sendTelegramGame(token: string, body: SendGame): Promise<Message | FetchError>;
527
+
528
+ export declare function sendTelegramInvoice(token: string, body: SendInvoice): Promise<Message | FetchError>;
529
+
530
+ export declare function sendTelegramLocation(token: string, body: SendLocation): Promise<Message | FetchError>;
531
+
532
+ export declare function sendTelegramMediaGroup(token: string, body: SendMediaGroupAlternative): Promise<Message[] | FetchError>;
533
+
534
+ export declare function sendTelegramMessage(token: string, body: SendMessage): Promise<Message | FetchError>;
535
+
536
+ export declare function sendTelegramMessageHTML(token: string, body: SendMessage): Promise<Message | FetchError>;
537
+
538
+ export declare function sendTelegramPaidMedia(token: string, body: SendPaidMediaAlternative): Promise<Message | FetchError>;
539
+
540
+ export declare function sendTelegramPhoto(token: string, body: SendPhoto): Promise<Message | FetchError>;
541
+
542
+ export declare function sendTelegramPoll(token: string, body: SendPoll): Promise<Message | FetchError>;
543
+
544
+ export declare function sendTelegramRepliableMessage<T>(token: string, body: SendRepliableMessage<T>): Promise<Message | FetchError>;
545
+
546
+ export declare function sendTelegramSticker(token: string, body: SendSticker): Promise<Message | FetchError>;
547
+
548
+ export declare function sendTelegramVenue(token: string, body: SendVenue): Promise<Message | FetchError>;
549
+
550
+ export declare function sendTelegramVideo(token: string, body: SendVideo): Promise<Message | FetchError>;
551
+
552
+ export declare function sendTelegramVideoNote(token: string, body: SendVideoNote): Promise<Message | FetchError>;
556
553
 
557
- export declare interface Start<T = any> extends Message {
558
- body: MessageBody<T>;
554
+ export declare function sendTelegramVoice(token: string, body: SendVoice): Promise<Message | FetchError>;
555
+
556
+ export declare function setMyTelegramCommands(token: string, body: SetMyCommands): Promise<boolean | FetchError>;
557
+
558
+ export declare function setMyTelegramDefaultAdministratorRights(token: string, body: SetMyDefaultAdministratorRights): Promise<boolean | FetchError>;
559
+
560
+ export declare function setMyTelegramDescription(token: string, body: SetMyDescription): Promise<boolean | FetchError>;
561
+
562
+ export declare function setMyTelegramName(token: string, body: SetMyName): Promise<boolean | FetchError>;
563
+
564
+ export declare function setMyTelegramShortDescription(token: string, body: SetMyShortDescription): Promise<boolean | FetchError>;
565
+
566
+ export declare function setTelegramChatAdministratorCustomTitle(token: string, body: SetChatAdministratorCustomTitle): Promise<boolean | FetchError>;
567
+
568
+ export declare function setTelegramChatDescription(token: string, body: SetChatDescription): Promise<boolean | FetchError>;
569
+
570
+ export declare function setTelegramChatMenuButton(token: string, body: SetChatMenuButton): Promise<boolean | FetchError>;
571
+
572
+ export declare function setTelegramChatPermissions(token: string, body: SetChatPermissions): Promise<boolean | FetchError>;
573
+
574
+ export declare function setTelegramChatPhoto(token: string, body: SetChatPhoto): Promise<boolean | FetchError>;
575
+
576
+ export declare function setTelegramChatStickerSet(token: string, body: SetChatStickerSet): Promise<boolean | FetchError>;
577
+
578
+ export declare function setTelegramChatTitle(token: string, body: SetChatTitle): Promise<boolean | FetchError>;
579
+
580
+ export declare function setTelegramCustomEmojiStickerSetThumbnail(token: string, body: SetCustomEmojiStickerSetThumbnail): Promise<boolean | FetchError>;
581
+
582
+ export declare function setTelegramGameScore(token: string, body: SetGameScore): Promise<boolean | FetchError>;
583
+
584
+ export declare function setTelegramMessageReaction(token: string, body: SetMessageReaction): Promise<boolean | FetchError>;
585
+
586
+ export declare function setTelegramPassportDataErrors(token: string, body: SetPassportDataErrors): Promise<boolean | FetchError>;
587
+
588
+ export declare function setTelegramStickerEmojiList(token: string, body: SetStickerEmojiList): Promise<boolean | FetchError>;
589
+
590
+ export declare function setTelegramStickerKeywords(token: string, body: SetStickerKeywords): Promise<boolean | FetchError>;
591
+
592
+ export declare function setTelegramStickerMaskPosition(token: string, body: SetStickerMaskPosition): Promise<boolean | FetchError>;
593
+
594
+ export declare function setTelegramStickerPositionInSet(token: string, body: SetStickerPositionInSet): Promise<boolean | FetchError>;
595
+
596
+ export declare function setTelegramStickerSetThumbnail(token: string, body: SetStickerSetThumbnail): Promise<boolean | FetchError>;
597
+
598
+ export declare function setTelegramStickerSetTitle(token: string, body: SetStickerSetTitle): Promise<boolean | FetchError>;
599
+
600
+ export declare function setTelegramWebhook(token: string, body: SetWebhook): Promise<boolean | FetchError>;
601
+
602
+ export declare interface Start<T = unknown> extends Message {
603
+ body: StartBody<T>;
559
604
  }
560
605
 
561
- export declare class StartUtils {
562
- static decodeBody<T>(text?: string): MessageBody<T>;
563
- static encodeBody<T>(data: T, type: string, chatID?: bigint): string;
564
- static encodeBodyToHREF<T>(username: string, data: T, type: string, chatID?: bigint): string;
565
- static encodeBodyToAnchorTag<T>(username: string, data: T, type: string, children: string, chatID?: bigint): string;
606
+ export declare interface StartBody<T = unknown> {
607
+ c?: bigint | number;
608
+ d: T;
609
+ m?: string;
566
610
  }
567
611
 
568
- declare class Stop extends Child {
569
- messageLiveLocation(parameters: StopMessageLiveLocation): Promise<Message | boolean | FetchError>;
570
- poll(chatID: bigint, messageID: number, parameters?: Partial<StopPoll>): Promise<Poll | FetchError>;
612
+ export declare function stopTelegramMessageLiveLocation(token: string, body: StopMessageLiveLocation): Promise<Message | boolean | FetchError>;
613
+
614
+ export declare function stopTelegramPoll(token: string, body: StopPoll): Promise<Poll | FetchError>;
615
+
616
+ export declare const TelegramAPI: API;
617
+
618
+ export declare namespace TelegramApiDefinitions {
619
+ export interface Config extends RestApiConfig {
620
+ token: string | undefined;
621
+ }
622
+ export interface Response<T> extends FetchResponse<ResponseData<T>> {
623
+ }
624
+ export interface ResponseData<T> {
625
+ ok: boolean;
626
+ result: T;
627
+ }
571
628
  }
572
629
 
573
- export declare class Telegram {
574
- /** INTERNAL */
575
- api: API;
576
- handlers: Handler[];
577
- hostname: string;
578
- id: bigint;
579
- name: TelegramName;
580
- port: number;
581
- token: string;
582
- username: string;
583
- /** BUILDERS */
584
- builder: Builder;
585
- /** CHILDS */
586
- add: Add;
587
- answer: Answer;
588
- approve: Approve;
589
- ban: Ban;
590
- close: Close;
591
- copy: Copy;
592
- create: Create;
593
- decline: Decline;
594
- delete: Delete;
595
- download: Download;
596
- edit: Edit;
597
- export: Export;
598
- forward: Forward;
599
- get: Get;
600
- hide: Hide;
601
- leave: Leave;
602
- log: Log;
603
- pin: Pin;
604
- polling: Polling;
605
- promote: Promote;
606
- refund: Refund;
607
- reopen: Reopen;
608
- replace: Replace;
609
- restrict: Restrict;
610
- revoke: Revoke;
611
- send: Send;
612
- set: Set_2;
613
- stop: Stop;
614
- unban: Unban;
615
- unhide: Unhide;
616
- unpin: Unpin;
617
- upload: Upload;
618
- webhook: Webhook;
619
- constructor(token: string, hostname?: string, port?: number);
620
- on<T extends UpdateType, U extends HandlerOptions>(type: T, middleware: HandlerMiddleware<T>, key?: string, description?: string, options?: U): void;
630
+ export declare const TelegramClassLogger: Logger;
631
+
632
+ export declare class TelegramClient {
633
+ protected listeners: TelegramClientListener[];
634
+ protected readonly id: string;
635
+ protected offset?: number;
636
+ protected token: string;
637
+ constructor(token: string);
638
+ connect(mode: TelegramClientConnectionMode, options?: TelegramClientConnectionOptions): Promise<void | FetchError | Error>;
639
+ disconnect(options?: TelegramClientDisconnectOptions): Promise<void>;
640
+ on<T extends UpdateType, U extends TelegramClientListenerOptions>(type: T, middleware: TelegramClientListenerMiddleware<T>, options?: U): void;
621
641
  handle(update: Update): void;
622
- handleCallbackQuery(query: CallbackQuery_2): Handler;
623
- handleChannelPost(post: Message): Handler;
624
- handleChatJoinRequest(request: ChatJoinRequest): Handler;
625
- handleChatMember(member: ChatMemberUpdated): Handler;
626
- handleChosenInlineResult(result: ChosenInlineResult): Handler;
627
- handleDocument(document: Message): Handler;
628
- handleEditedChannelPost(post: Message): Handler;
629
- handleEditedMessage(message: Message): Handler;
630
- handleInlineQuery(query: InlineQuery): Handler;
631
- handleMessage(message: Message): Handler;
632
- handleMyChatMember(member: ChatMemberUpdated): Handler;
633
- handlePoll(poll: Poll): Handler;
634
- handlePollAnswer(answer: PollAnswer): Handler;
635
- handlePreCheckoutQuery(query: PreCheckoutQuery): Handler;
636
- handleReplyToMessage(reply: Message): Handler;
637
- handleShippingQuery(query: ShippingQuery): Handler;
638
- handleStart(start: Message): Handler;
639
- private findMatchingHandler;
640
- get commands(): BotCommand[];
641
- private get handlerIDs();
642
+ protected handleBusinessConnection(connection: BusinessConnection): TelegramClientListener | undefined;
643
+ protected handleBusinessMessage(message: Message): TelegramClientListener | undefined;
644
+ protected handleCallbackQuery(query: CallbackQuery_2): TelegramClientListener | undefined;
645
+ protected handleChannelPost(post: Message): TelegramClientListener | undefined;
646
+ protected handleChatBoost(boost: ChatBoostUpdated): TelegramClientListener | undefined;
647
+ protected handleChatJoinRequest(request: ChatJoinRequest): TelegramClientListener | undefined;
648
+ protected handleChatMember(member: ChatMemberUpdated): TelegramClientListener | undefined;
649
+ protected handleChosenInlineResult(result: ChosenInlineResult): TelegramClientListener | undefined;
650
+ protected handleDeletedBusinessMessages(deleted: BusinessMessagesDeleted): TelegramClientListener | undefined;
651
+ protected handleEditedBusinessMessage(message: Message): TelegramClientListener | undefined;
652
+ protected handleEditedChannelPost(post: Message): TelegramClientListener | undefined;
653
+ protected handleEditedMessage(message: Message): TelegramClientListener | undefined;
654
+ protected handleInlineQuery(query: InlineQuery): TelegramClientListener | undefined;
655
+ protected handleMessage(message: Message): TelegramClientListener | undefined;
656
+ protected handleMessageReaction(reaction: MessageReactionUpdated): TelegramClientListener | undefined;
657
+ protected handleMessageReactionCount(count: MessageReactionCountUpdated): TelegramClientListener | undefined;
658
+ protected handleMyChatMember(member: ChatMemberUpdated): TelegramClientListener | undefined;
659
+ protected handlePoll(poll: Poll): TelegramClientListener | undefined;
660
+ protected handlePollAnswer(answer: PollAnswer): TelegramClientListener | undefined;
661
+ protected handlePreCheckoutQuery(query: PreCheckoutQuery): TelegramClientListener | undefined;
662
+ protected handleRemovedChatBoost(removed: ChatBoostRemoved): TelegramClientListener | undefined;
663
+ protected handleReplyToMessage(reply: Message): TelegramClientListener | undefined;
664
+ protected handleShippingQuery(query: ShippingQuery): TelegramClientListener | undefined;
665
+ protected handleStart(start: Message): TelegramClientListener | undefined;
666
+ protected poll(options?: TelegramClientConnectionOptionsPolling): Promise<void>;
667
+ protected findListener<T extends UpdateType, U extends TelegramClientListenerOptions>(type: UpdateType, command?: string): TelegramClientListener<T, U> | undefined;
668
+ getCommands(): BotCommand[];
669
+ getListeners(): TelegramClientListener[];
670
+ getToken(): string;
671
+ setToken(token: string): this;
672
+ protected get listenerIDs(): string[];
673
+ }
674
+
675
+ export declare type TelegramClientConnectionMode = 'polling' | 'webhook';
676
+
677
+ export declare interface TelegramClientConnectionOptions {
678
+ polling?: TelegramClientConnectionOptionsPolling;
679
+ webhook?: TelegramClientConnectionOptionsWebhook;
680
+ }
681
+
682
+ export declare interface TelegramClientConnectionOptionsPolling extends GetUpdates {
683
+ ms?: number;
684
+ }
685
+
686
+ export declare interface TelegramClientConnectionOptionsWebhook extends SetWebhook {
687
+ delete?: DeleteWebhook;
688
+ }
689
+
690
+ export declare interface TelegramClientDisconnectOptions {
691
+ webhook?: DeleteWebhook;
692
+ }
693
+
694
+ export declare interface TelegramClientListener<T extends UpdateType = any, U extends TelegramClientListenerOptions = TelegramClientListenerOptions> {
695
+ command?: string;
696
+ description?: string;
697
+ id: string;
698
+ middleware: TelegramClientListenerMiddleware<T>;
699
+ options: Omit<U, 'command' | 'description'>;
700
+ type: UpdateType;
642
701
  }
643
702
 
644
- export declare const TelegramConfiguration: ConfigurationBuilder;
703
+ export declare type TelegramClientListenerMiddleware<T extends UpdateType> = (context: Context[T]) => any;
645
704
 
646
- export declare enum TelegramLoggerName {
647
- MODULE = "TELEGRAM_MODULE"
705
+ export declare interface TelegramClientListenerOptions {
706
+ command?: string;
707
+ deleteOnCallbackQuery?: boolean;
708
+ deleteOnReply?: boolean;
709
+ deleteOnMessageStart?: boolean;
710
+ description?: string;
648
711
  }
649
712
 
650
- declare interface TelegramName {
651
- first: string;
652
- last: string;
653
- }
713
+ export declare const TelegramFileAPI: API_2;
654
714
 
655
- declare class Unban extends Child {
656
- chatMember(parameters: UnbanChatMember): Promise<boolean | FetchError>;
657
- chatSenderChat(parameters: UnbanChatSenderChat): Promise<boolean | FetchError>;
715
+ export declare enum TelegramLoggerName {
716
+ CLASS = "TELEGRAM_CLASS"
658
717
  }
659
718
 
660
- declare class Unhide extends Child {
661
- generalForumTopic(chatID: bigint, parameters?: Partial<HideGeneralForumTopic>): Promise<boolean | FetchError>;
662
- }
719
+ export declare function unbanTelegramChatMember(token: string, body: UnbanChatMember): Promise<boolean | FetchError>;
663
720
 
664
- declare class Unpin extends Child {
665
- allChatMessages(chatID: bigint, parameters?: Partial<UnpinAllChatMessages>): Promise<boolean | FetchError>;
666
- allForumTopicMessages(chatID: bigint, messageThreadID: number, parameters?: Partial<UnpinAllForumTopicMessages>): Promise<boolean | FetchError>;
667
- allGeneralForumTopicMessages(chatID: bigint, parameters?: Partial<UnpinAllGeneralForumTopicMessages>): Promise<boolean | FetchError>;
668
- chatMessage(chatID: bigint, parameters?: Partial<UnpinChatMessage>): Promise<boolean | FetchError>;
669
- }
721
+ export declare function unbanTelegramChatSenderChat(token: string, body: UnbanChatSenderChat): Promise<boolean | FetchError>;
670
722
 
671
- export declare enum UpdateType {
672
- CALLBACK_QUERY = "CALLBACK_QUERY",
673
- CHANNEL_POST = "CHANNEL_POST",
674
- CHAT_JOIN_REQUEST = "CHAT_JOIN_REQUEST",
675
- CHAT_MEMBER = "CHAT_MEMBER",
676
- CHOSEN_INLINE_RESULT = "CHOSEN_INLINE_RESULT",
677
- DOCUMENT = "DOCUMENT",
678
- EDITED_CHANNEL_POST = "EDITED_CHANNEL_POST",
679
- EDITED_MESSAGE = "EDITED_MESSAGE",
680
- INLINE_QUERY = "INLINE_QUERY",
681
- MESSAGE = "MESSAGE",
682
- MY_CHAT_MEMBER = "MY_CHAT_MEMBER",
683
- POLL = "POLL",
684
- POLL_ANSWER = "POLL_ANSWER",
685
- PRE_CHECKOUT_QUERY = "PRE_CHECKOUT_QUERY",
686
- REPLY_TO_MESSAGE = "REPLY_TO_MESSAGE",
687
- SHIPPING_QUERY = "SHIPPING_QUERY",
688
- START = "START"
689
- }
723
+ export declare function unhideTelegramGeneralForumTopic(token: string, body: HideGeneralForumTopic): Promise<boolean | FetchError>;
690
724
 
691
- declare class Upload extends Child {
692
- stickerFile(userID: bigint, parameters: Omit<UploadStickerFile, 'user_id'>): Promise<File_2 | FetchError>;
693
- }
725
+ export declare function unpinAllTelegramChatMessages(token: string, body: UnpinAllChatMessages): Promise<boolean | FetchError>;
694
726
 
695
- declare class Webhook extends Child {
696
- close(): Promise<boolean | FetchError>;
697
- delete(parameters?: Partial<DeleteWebhook>): Promise<boolean | FetchError>;
698
- getInfo(): Promise<WebhookInfo | FetchError>;
699
- set(route?: string, parameters?: Partial<SetWebhook>): Promise<boolean | FetchError>;
700
- url(route: string): string;
701
- }
727
+ export declare function unpinAllTelegramForumTopicMessages(token: string, body: UnpinAllForumTopicMessages): Promise<boolean | FetchError>;
728
+
729
+ export declare function unpinAllTelegramGeneralForumTopicMessages(token: string, body: UnpinAllGeneralForumTopicMessages): Promise<boolean | FetchError>;
730
+
731
+ export declare function unpinTelegramChatMessage(token: string, body: UnpinChatMessage): Promise<boolean | FetchError>;
732
+
733
+ export declare type UpdateType = 'business_connection' | 'business_message' | 'callback_query' | 'channel_post' | 'chat_boost' | 'chat_join_request' | 'chat_member' | 'chosen_inline_result' | 'deleted_business_messages' | 'edited_business_message' | 'edited_channel_post' | 'edited_message' | 'inline_query' | 'message' | 'message_reaction' | 'message_reaction_count' | 'my_chat_member' | 'poll' | 'poll_answer' | 'pre_checkout_query' | 'removed_chat_boost' | 'reply_to_message' | 'shipping_query' | 'start';
734
+
735
+ export declare function uploadTelegramStickerFile(token: string, body: UploadStickerFile): Promise<File_2 | FetchError>;
702
736
 
703
737
  export { }