@mtkruto/node 0.1.145 → 0.1.147

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 (71) hide show
  1. package/esm/3_types.d.ts +3 -1
  2. package/esm/3_types.js +3 -1
  3. package/esm/4_constants.d.ts +1 -1
  4. package/esm/4_constants.js +1 -1
  5. package/esm/client/1_reaction_manager.d.ts +4 -2
  6. package/esm/client/2_message_manager.d.ts +3 -2
  7. package/esm/client/2_message_manager.js +19 -2
  8. package/esm/client/3_callback_query_manager.d.ts +3 -2
  9. package/esm/client/3_chat_list_manager.d.ts +3 -2
  10. package/esm/client/3_inline_query_manager.d.ts +3 -2
  11. package/esm/client/3_inline_query_manager.js +1 -1
  12. package/esm/types/0_mini_app_info.d.ts +6 -0
  13. package/esm/types/0_mini_app_info.js +3 -0
  14. package/esm/types/0_network_statistics_entry.d.ts +1 -0
  15. package/esm/types/0_reaction.d.ts +1 -0
  16. package/esm/types/1_inline_query_result_button.d.ts +2 -2
  17. package/esm/types/1_input_message_content.d.ts +1 -0
  18. package/esm/types/1_keyboard_button.d.ts +5 -4
  19. package/esm/types/1_keyboard_button.js +3 -3
  20. package/esm/types/1_network_statistics.d.ts +1 -0
  21. package/esm/types/2_inline_keyboard_button.d.ts +4 -4
  22. package/esm/types/2_inline_keyboard_button.js +4 -4
  23. package/esm/types/2_inline_query.d.ts +1 -0
  24. package/esm/types/2_invite_link.d.ts +23 -0
  25. package/esm/types/2_invite_link.js +27 -0
  26. package/esm/types/2_message_reaction_count.d.ts +1 -0
  27. package/esm/types/3_chat_member_updated.d.ts +23 -0
  28. package/esm/types/3_chat_member_updated.js +33 -0
  29. package/esm/types/4_inline_query_result.d.ts +1 -0
  30. package/esm/types/4_inline_query_result.js +1 -1
  31. package/esm/types/4_message.d.ts +8 -8
  32. package/esm/types/4_message.js +2 -2
  33. package/esm/types/6_update.d.ts +19 -2
  34. package/package.json +1 -1
  35. package/script/3_types.d.ts +3 -1
  36. package/script/3_types.js +3 -1
  37. package/script/4_constants.d.ts +1 -1
  38. package/script/4_constants.js +1 -1
  39. package/script/client/1_reaction_manager.d.ts +4 -2
  40. package/script/client/2_message_manager.d.ts +3 -2
  41. package/script/client/2_message_manager.js +51 -34
  42. package/script/client/3_callback_query_manager.d.ts +3 -2
  43. package/script/client/3_chat_list_manager.d.ts +3 -2
  44. package/script/client/3_inline_query_manager.d.ts +3 -2
  45. package/script/client/3_inline_query_manager.js +1 -1
  46. package/script/types/0_mini_app_info.d.ts +6 -0
  47. package/script/types/0_mini_app_info.js +7 -0
  48. package/script/types/0_network_statistics_entry.d.ts +1 -0
  49. package/script/types/0_reaction.d.ts +1 -0
  50. package/script/types/1_inline_query_result_button.d.ts +2 -2
  51. package/script/types/1_input_message_content.d.ts +1 -0
  52. package/script/types/1_keyboard_button.d.ts +5 -4
  53. package/script/types/1_keyboard_button.js +3 -3
  54. package/script/types/1_network_statistics.d.ts +1 -0
  55. package/script/types/2_inline_keyboard_button.d.ts +4 -4
  56. package/script/types/2_inline_keyboard_button.js +4 -4
  57. package/script/types/2_inline_query.d.ts +1 -0
  58. package/script/types/2_invite_link.d.ts +23 -0
  59. package/script/types/2_invite_link.js +31 -0
  60. package/script/types/2_message_reaction_count.d.ts +1 -0
  61. package/script/types/3_chat_member_updated.d.ts +23 -0
  62. package/script/types/3_chat_member_updated.js +37 -0
  63. package/script/types/4_inline_query_result.d.ts +1 -0
  64. package/script/types/4_inline_query_result.js +1 -1
  65. package/script/types/4_message.d.ts +8 -8
  66. package/script/types/4_message.js +2 -2
  67. package/script/types/6_update.d.ts +19 -2
  68. package/esm/types/0_web_app_info.d.ts +0 -5
  69. package/esm/types/0_web_app_info.js +0 -3
  70. package/script/types/0_web_app_info.d.ts +0 -5
  71. package/script/types/0_web_app_info.js +0 -7
package/esm/3_types.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from "./types/0_login_url.js";
18
18
  export * from "./types/0_mask_position.js";
19
19
  export * from "./types/0_message_entity.js";
20
20
  export * from "./types/0_message_identifier.js";
21
+ export * from "./types/0_mini_app_info.js";
21
22
  export * from "./types/0_network_statistics_entry.js";
22
23
  export * from "./types/0_parse_mode.js";
23
24
  export * from "./types/0_poll_option.js";
@@ -26,7 +27,6 @@ export * from "./types/0_restriction_reason.js";
26
27
  export * from "./types/0_thumbnail.js";
27
28
  export * from "./types/0_venue.js";
28
29
  export * from "./types/0_voice.js";
29
- export * from "./types/0_web_app_info.js";
30
30
  export * from "./types/1_animation.js";
31
31
  export * from "./types/1_audio.js";
32
32
  export * from "./types/1_bot_command_scope.js";
@@ -52,9 +52,11 @@ export * from "./types/2_chosen_inline_result.js";
52
52
  export * from "./types/2_game.js";
53
53
  export * from "./types/2_inline_keyboard_button.js";
54
54
  export * from "./types/2_inline_query.js";
55
+ export * from "./types/2_invite_link.js";
55
56
  export * from "./types/2_message_interactions.js";
56
57
  export * from "./types/2_message_reaction_count.js";
57
58
  export * from "./types/2_message_reactions.js";
59
+ export * from "./types/3_chat_member_updated.js";
58
60
  export * from "./types/3_reply_markup.js";
59
61
  export * from "./types/4_inline_query_result.js";
60
62
  export * from "./types/4_message.js";
package/esm/3_types.js CHANGED
@@ -18,6 +18,7 @@ export * from "./types/0_login_url.js";
18
18
  export * from "./types/0_mask_position.js";
19
19
  export * from "./types/0_message_entity.js";
20
20
  export * from "./types/0_message_identifier.js";
21
+ export * from "./types/0_mini_app_info.js";
21
22
  export * from "./types/0_network_statistics_entry.js";
22
23
  export * from "./types/0_parse_mode.js";
23
24
  export * from "./types/0_poll_option.js";
@@ -26,7 +27,6 @@ export * from "./types/0_restriction_reason.js";
26
27
  export * from "./types/0_thumbnail.js";
27
28
  export * from "./types/0_venue.js";
28
29
  export * from "./types/0_voice.js";
29
- export * from "./types/0_web_app_info.js";
30
30
  export * from "./types/1_animation.js";
31
31
  export * from "./types/1_audio.js";
32
32
  export * from "./types/1_bot_command_scope.js";
@@ -52,9 +52,11 @@ export * from "./types/2_chosen_inline_result.js";
52
52
  export * from "./types/2_game.js";
53
53
  export * from "./types/2_inline_keyboard_button.js";
54
54
  export * from "./types/2_inline_query.js";
55
+ export * from "./types/2_invite_link.js";
55
56
  export * from "./types/2_message_interactions.js";
56
57
  export * from "./types/2_message_reaction_count.js";
57
58
  export * from "./types/2_message_reactions.js";
59
+ export * from "./types/3_chat_member_updated.js";
58
60
  export * from "./types/3_reply_markup.js";
59
61
  export * from "./types/4_inline_query_result.js";
60
62
  export * from "./types/4_message.js";
@@ -4,7 +4,7 @@ export type PublicKeys = readonly [bigint, [bigint, bigint]][];
4
4
  export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const INITIAL_DC: DC;
6
6
  export declare const LAYER = 172;
7
- export declare const APP_VERSION = "MTKruto 0.1.145";
7
+ export declare const APP_VERSION = "MTKruto 0.1.147";
8
8
  export declare const DEVICE_MODEL: string;
9
9
  export declare const LANG_CODE: string;
10
10
  export declare const LANG_PACK = "";
@@ -53,7 +53,7 @@ export const PUBLIC_KEYS = Object.freeze([
53
53
  ]);
54
54
  export const INITIAL_DC = "2";
55
55
  export const LAYER = 172;
56
- export const APP_VERSION = "MTKruto 0.1.145";
56
+ export const APP_VERSION = "MTKruto 0.1.147";
57
57
  // @ts-ignore: lib
58
58
  export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
59
59
  export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -1,9 +1,11 @@
1
1
  import { enums, types } from "../2_tl.js";
2
2
  import { Update } from "../3_types.js";
3
3
  import { C } from "./0_types.js";
4
+ type ReactionManagerUpdate = types.UpdateBotMessageReactions | types.UpdateBotMessageReaction | types.UpdateMessageReactions | types.UpdateChannelMessageViews | types.UpdateChannelMessageForwards;
4
5
  export declare class ReactionManager {
5
6
  #private;
6
7
  constructor(c: C);
7
- static canHandleUpdate(update: enums.Update): update is types.UpdateBotMessageReactions | types.UpdateBotMessageReaction | types.UpdateMessageReactions | types.UpdateChannelMessageViews | types.UpdateChannelMessageForwards;
8
- handleUpdate(update: types.UpdateBotMessageReactions | types.UpdateBotMessageReaction | types.UpdateMessageReactions | types.UpdateChannelMessageViews | types.UpdateChannelMessageForwards): Promise<Update | null>;
8
+ static canHandleUpdate(update: enums.Update): update is ReactionManagerUpdate;
9
+ handleUpdate(update: ReactionManagerUpdate): Promise<Update | null>;
9
10
  }
11
+ export {};
@@ -7,6 +7,7 @@ import { FileManager } from "./1_file_manager.js";
7
7
  interface C extends C_ {
8
8
  fileManager: FileManager;
9
9
  }
10
+ type MessageManagerUpdate = types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdateEditMessage | types.UpdateEditChannelMessage | types.UpdateDeleteMessages | types.UpdateDeleteChannelMessages | types.UpdateChannelParticipant | types.UpdateChatParticipant;
10
11
  export declare class MessageManager {
11
12
  #private;
12
13
  constructor(c: C);
@@ -46,8 +47,8 @@ export declare class MessageManager {
46
47
  setReactions(chatId: number, messageId: number, reactions: Reaction[], params?: SetReactionsParams): Promise<void>;
47
48
  addReaction(chatId: number, messageId: number, reaction: Reaction, params?: AddReactionParams): Promise<void>;
48
49
  removeReaction(chatId: number, messageId: number, reaction: Reaction): Promise<void>;
49
- static canHandleUpdate(update: enums.Update): update is types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdateEditMessage | types.UpdateEditChannelMessage | types.UpdateDeleteMessages | types.UpdateDeleteChannelMessages;
50
- handleUpdate(update: types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdateEditMessage | types.UpdateEditChannelMessage | types.UpdateDeleteMessages | types.UpdateDeleteChannelMessages): Promise<Update | null>;
50
+ static canHandleUpdate(update: enums.Update): update is MessageManagerUpdate;
51
+ handleUpdate(update: MessageManagerUpdate): Promise<Update | null>;
51
52
  sendChatAction(chatId: ID, action: ChatAction, params?: {
52
53
  messageThreadId?: number;
53
54
  }): Promise<void>;
@@ -13,6 +13,7 @@ var _MessageManager_instances, _MessageManager_c, _MessageManager_updatesToMessa
13
13
  import { contentType, debug } from "../0_deps.js";
14
14
  import { getRandomId, toUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
15
15
  import { as, getChannelChatId, peerToChatId, types } from "../2_tl.js";
16
+ import { constructChatMemberUpdated } from "../3_types.js";
16
17
  import { assertMessageType, chatMemberRightsToTlObject, constructChatMember, constructMessage as constructMessage_, FileID, FileType, messageEntityToTlObject, reactionEqual, reactionToTlObject, replyMarkupToTlObject } from "../3_types.js";
17
18
  import { STICKER_SET_NAME_TTL } from "../4_constants.js";
18
19
  import { parseHtml } from "./0_html.js";
@@ -531,14 +532,20 @@ export class MessageManager {
531
532
  }
532
533
  }
533
534
  static canHandleUpdate(update) {
534
- return update instanceof types.UpdateNewMessage || update instanceof types.UpdateNewChannelMessage || update instanceof types.UpdateEditMessage || update instanceof types.UpdateEditChannelMessage || update instanceof types.UpdateDeleteMessages || update instanceof types.UpdateDeleteChannelMessages;
535
+ return update instanceof types.UpdateNewMessage ||
536
+ update instanceof types.UpdateNewChannelMessage ||
537
+ update instanceof types.UpdateEditMessage ||
538
+ update instanceof types.UpdateEditChannelMessage ||
539
+ update instanceof types.UpdateDeleteMessages ||
540
+ update instanceof types.UpdateDeleteChannelMessages ||
541
+ update instanceof types.UpdateChannelParticipant ||
542
+ update instanceof types.UpdateChatParticipant;
535
543
  }
536
544
  async handleUpdate(update) {
537
545
  if (update instanceof types.UpdateNewMessage || update instanceof types.UpdateNewChannelMessage || update instanceof types.UpdateEditMessage || update instanceof types.UpdateEditChannelMessage) {
538
546
  if (update.message instanceof types.Message || update.message instanceof types.MessageService) {
539
547
  const chatId = peerToChatId(update.message.peer_id);
540
548
  await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.setMessage(chatId, update.message.id, update.message);
541
- // promises.push(this.#chatListManager.reassignChatLastMessage(chatId));
542
549
  }
543
550
  }
544
551
  if (update instanceof types.UpdateNewMessage ||
@@ -585,6 +592,16 @@ export class MessageManager {
585
592
  }
586
593
  return { deletedMessages };
587
594
  }
595
+ if (update instanceof types.UpdateChannelParticipant || update instanceof types.UpdateChatParticipant) {
596
+ const chatMember = await constructChatMemberUpdated(update, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
597
+ const selfId = await __classPrivateFieldGet(this, _MessageManager_c, "f").getSelfId();
598
+ if (chatMember.oldChatMember.user.id == selfId) {
599
+ return { myChatMember: chatMember };
600
+ }
601
+ else {
602
+ return { chatMember };
603
+ }
604
+ }
588
605
  return null;
589
606
  }
590
607
  async sendChatAction(chatId, action, params) {
@@ -6,11 +6,12 @@ import { MessageManager } from "./2_message_manager.js";
6
6
  type C = C_ & {
7
7
  messageManager: MessageManager;
8
8
  };
9
+ type CallbackQueryManagerUpdate = types.UpdateBotCallbackQuery | types.UpdateInlineBotCallbackQuery;
9
10
  export declare class CallbackQueryManager {
10
11
  #private;
11
12
  constructor(c: C);
12
13
  answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
13
- static canHandleUpdate(update: enums.Update): update is types.UpdateBotCallbackQuery | types.UpdateInlineBotCallbackQuery;
14
- handleUpdate(update: types.UpdateBotCallbackQuery | types.UpdateInlineBotCallbackQuery): Promise<Update>;
14
+ static canHandleUpdate(update: enums.Update): update is CallbackQueryManagerUpdate;
15
+ handleUpdate(update: CallbackQueryManagerUpdate): Promise<Update>;
15
16
  }
16
17
  export {};
@@ -5,13 +5,14 @@ import { MessageManager } from "./2_message_manager.js";
5
5
  type C = C_ & {
6
6
  messageManager: MessageManager;
7
7
  };
8
+ type ChatListManagerUpdate = types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdatePinnedDialogs | types.UpdateFolderPeers | types.UpdateChannel | types.UpdateChat | types.UpdateUser | types.UpdateUserName;
8
9
  export declare class ChatListManager {
9
10
  #private;
10
11
  constructor(c: C);
11
12
  reassignChatLastMessage(chatId: number, add?: boolean, sendUpdate?: boolean): Promise<() => Promise<void>>;
12
13
  getChats(from?: "archived" | "main", after?: Chat, limit?: number): Promise<Chat[]>;
13
- static canHandleUpdate(update: enums.Update): update is types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdatePinnedDialogs | types.UpdateFolderPeers | types.UpdateChannel | types.UpdateChat | types.UpdateUser | types.UpdateUserName;
14
- handleUpdate(update: types.UpdateNewMessage | types.UpdateNewChannelMessage | types.UpdatePinnedDialogs | types.UpdateFolderPeers | types.UpdateChannel | types.UpdateChat | types.UpdateUser | types.UpdateUserName): Promise<void>;
14
+ static canHandleUpdate(update: enums.Update): update is ChatListManagerUpdate;
15
+ handleUpdate(update: ChatListManagerUpdate): Promise<void>;
15
16
  getChat(chatId: ID): Promise<Chat>;
16
17
  }
17
18
  export {};
@@ -6,11 +6,12 @@ import { MessageManager } from "./2_message_manager.js";
6
6
  type C = C_ & {
7
7
  messageManager: MessageManager;
8
8
  };
9
+ type InlineQueryManagerUpdate = types.UpdateBotInlineQuery | types.UpdateBotInlineSend;
9
10
  export declare class InlineQueryManager {
10
11
  #private;
11
12
  constructor(c: C);
12
13
  answerInlineQuery(id: string, results: InlineQueryResult[], params?: AnswerInlineQueryParams): Promise<void>;
13
- static canHandleUpdate(update: enums.Update): update is types.UpdateBotInlineQuery | types.UpdateBotInlineSend;
14
- handleUpdate(update: types.UpdateBotInlineQuery | types.UpdateBotInlineSend): Promise<Update>;
14
+ static canHandleUpdate(update: enums.Update): update is InlineQueryManagerUpdate;
15
+ handleUpdate(update: InlineQueryManagerUpdate): Promise<Update>;
15
16
  }
16
17
  export {};
@@ -25,7 +25,7 @@ export class InlineQueryManager {
25
25
  results: await Promise.all(results.map((v) => inlineQueryResultToTlObject(v, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.parseText.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager), __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.usernameResolver.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager)))),
26
26
  cache_time: params?.cacheTime ?? 300,
27
27
  private: params?.isPersonal ? true : undefined,
28
- switch_webview: params?.button && params.button.webApp ? new types.InlineBotWebView({ text: params.button.text, url: params.button.webApp.url }) : undefined,
28
+ switch_webview: params?.button && params.button.miniApp ? new types.InlineBotWebView({ text: params.button.text, url: params.button.miniApp.url }) : undefined,
29
29
  switch_pm: params?.button && params.button.startParameter ? new types.InlineBotSwitchPM({ text: params.button.text, start_param: params.button.startParameter }) : undefined,
30
30
  gallery: params?.isGallery ? true : undefined,
31
31
  next_offset: params?.nextOffset,
@@ -0,0 +1,6 @@
1
+ /** The necessary information to launch a mini app. */
2
+ export interface MiniAppInfo {
3
+ /** An HTTPS URL of the mini app to be opened with additional data. */
4
+ url: string;
5
+ }
6
+ export declare function constructMiniAppInfo(url: string): MiniAppInfo;
@@ -0,0 +1,3 @@
1
+ export function constructMiniAppInfo(url) {
2
+ return { url };
3
+ }
@@ -1,3 +1,4 @@
1
+ /** An entry of a client's network statistics. */
1
2
  export interface NetworkStatisticsEntry {
2
3
  sent: number;
3
4
  received: number;
@@ -9,6 +9,7 @@ export interface ReactionCustomEmoji {
9
9
  type: "customEmoji";
10
10
  id: string;
11
11
  }
12
+ /** A reaction type. */
12
13
  export type Reaction = ReactionEmoji | ReactionCustomEmoji;
13
14
  export declare function constructReaction(reaction: enums.Reaction): Reaction;
14
15
  export declare function reactionToTlObject(reaction: Reaction): enums.Reaction;
@@ -1,6 +1,6 @@
1
- import { WebAppInfo } from "./0_web_app_info.js";
1
+ import { MiniAppInfo } from "./0_mini_app_info.js";
2
2
  export interface InlineQueryResultButton {
3
3
  text: string;
4
- webApp?: WebAppInfo;
4
+ miniApp?: MiniAppInfo;
5
5
  startParameter?: string;
6
6
  }
@@ -85,4 +85,5 @@ export interface InputMessageContentInvoice {
85
85
  sendEmailToProvider?: boolean;
86
86
  isFlexible?: boolean;
87
87
  }
88
+ /** The content of a message to be returned as an inline query result. */
88
89
  export type InputMessageContent = InputMessageContentText | InputMessageContentLocation | InputMessageContentVenue | InputMessageContentContact | InputMessageContentInvoice;
@@ -1,7 +1,7 @@
1
1
  import { enums } from "../2_tl.js";
2
2
  import { ChatAdministratorRights } from "./0_chat_administrator_rights.js";
3
3
  import { KeyboardButtonPollType } from "./0_keyboard_button_poll_type.js";
4
- import { WebAppInfo } from "./0_web_app_info.js";
4
+ import { MiniAppInfo } from "./0_mini_app_info.js";
5
5
  /** @unlisted */
6
6
  export interface KeyboardButtonText {
7
7
  text: string;
@@ -40,9 +40,10 @@ export interface KeyboardButtonRequestPoll extends KeyboardButtonText {
40
40
  requestPoll: KeyboardButtonPollType;
41
41
  }
42
42
  /** @unlisted */
43
- export interface KeyboardButtonWebApp extends KeyboardButtonText {
44
- webApp: WebAppInfo;
43
+ export interface KeyboardButtonMiniApp extends KeyboardButtonText {
44
+ miniApp: MiniAppInfo;
45
45
  }
46
- export type KeyboardButton = KeyboardButtonText | KeyboardButtonRequestUser | KeyboardButtonRequestChat | KeyboardButtonRequestContact | KeyboardButtonRequestLocation | KeyboardButtonRequestPoll | KeyboardButtonWebApp;
46
+ /** A button of a custom keyboard. */
47
+ export type KeyboardButton = KeyboardButtonText | KeyboardButtonRequestUser | KeyboardButtonRequestChat | KeyboardButtonRequestContact | KeyboardButtonRequestLocation | KeyboardButtonRequestPoll | KeyboardButtonMiniApp;
47
48
  export declare function constructKeyboardButton(button_: enums.KeyboardButton): KeyboardButton;
48
49
  export declare function keyboardButtonToTlObject(button: KeyboardButton): import("../tl/2_types.js").KeyboardButton_ | import("../tl/2_types.js").KeyboardButtonRequestPhone_ | import("../tl/2_types.js").KeyboardButtonRequestGeoLocation_ | import("../tl/2_types.js").KeyboardButtonRequestPoll_ | import("../tl/2_types.js").KeyboardButtonWebView_ | import("../tl/2_types.js").KeyboardButtonRequestPeer_;
@@ -72,7 +72,7 @@ export function constructKeyboardButton(button_) {
72
72
  return button;
73
73
  }
74
74
  else if (button_ instanceof types.KeyboardButtonWebView || button_ instanceof types.KeyboardButtonSimpleWebView) {
75
- return { text: button_.text, webApp: { url: button_.url } };
75
+ return { text: button_.text, miniApp: { url: button_.url } };
76
76
  }
77
77
  else {
78
78
  UNREACHABLE();
@@ -126,8 +126,8 @@ export function keyboardButtonToTlObject(button) {
126
126
  else if ("requestPoll" in button) {
127
127
  return new types.KeyboardButtonRequestPoll({ text: button.text, quiz: button.requestPoll.type == "quiz" });
128
128
  }
129
- else if ("webApp" in button) {
130
- return new types.KeyboardButtonWebView({ text: button.text, url: button.webApp.url });
129
+ else if ("miniApp" in button) {
130
+ return new types.KeyboardButtonWebView({ text: button.text, url: button.miniApp.url });
131
131
  }
132
132
  else {
133
133
  return new types.KeyboardButton({ text: button.text });
@@ -1,4 +1,5 @@
1
1
  import { NetworkStatisticsEntry } from "./0_network_statistics_entry.js";
2
+ /** A client's network statistics. */
2
3
  export interface NetworkStatistics {
3
4
  messages: NetworkStatisticsEntry;
4
5
  cdn: NetworkStatisticsEntry;
@@ -1,6 +1,6 @@
1
1
  import { enums } from "../2_tl.js";
2
2
  import { LoginUrl } from "./0_login_url.js";
3
- import { WebAppInfo } from "./0_web_app_info.js";
3
+ import { MiniAppInfo } from "./0_mini_app_info.js";
4
4
  import { UsernameResolver } from "./1__getters.js";
5
5
  /** @unlisted */
6
6
  export interface _InlineKeyboardButtonBase {
@@ -15,8 +15,8 @@ export interface InlineKeyboardButtonCallback extends _InlineKeyboardButtonBase
15
15
  callbackData: string;
16
16
  }
17
17
  /** @unlisted */
18
- export interface InlineKeyboardButtonWebApp extends _InlineKeyboardButtonBase {
19
- webApp: WebAppInfo;
18
+ export interface InlineKeyboardButtonMiniApp extends _InlineKeyboardButtonBase {
19
+ miniApp: MiniAppInfo;
20
20
  }
21
21
  /** @unlisted */
22
22
  export interface InlineKeyboardButtonLogin extends _InlineKeyboardButtonBase {
@@ -39,6 +39,6 @@ export interface InlineKeyboardButtonPay extends _InlineKeyboardButtonBase {
39
39
  pay: boolean;
40
40
  }
41
41
  /** A button of an inline keyboard. */
42
- export type InlineKeyboardButton = InlineKeyboardButtonURL | InlineKeyboardButtonCallback | InlineKeyboardButtonWebApp | InlineKeyboardButtonLogin | InlineKeyboardButtonSwitchInline | InlineKeyboardButtonSwitchInlineCurrent | InlineKeyboardButtonGame | InlineKeyboardButtonPay;
42
+ export type InlineKeyboardButton = InlineKeyboardButtonURL | InlineKeyboardButtonCallback | InlineKeyboardButtonMiniApp | InlineKeyboardButtonLogin | InlineKeyboardButtonSwitchInline | InlineKeyboardButtonSwitchInlineCurrent | InlineKeyboardButtonGame | InlineKeyboardButtonPay;
43
43
  export declare function constructInlineKeyboardButton(button_: enums.KeyboardButton): InlineKeyboardButton;
44
44
  export declare function inlineKeyboardButtonToTlObject(button: InlineKeyboardButton, usernameResolver: UsernameResolver): Promise<import("../tl/2_types.js").KeyboardButtonUrl_ | import("../tl/2_types.js").KeyboardButtonCallback_ | import("../tl/2_types.js").KeyboardButtonSwitchInline_ | import("../tl/2_types.js").KeyboardButtonBuy_ | import("../tl/2_types.js").InputKeyboardButtonUrlAuth_ | import("../tl/2_types.js").KeyboardButtonWebView_>;
@@ -1,6 +1,6 @@
1
1
  import { UNREACHABLE } from "../1_utilities.js";
2
2
  import { types } from "../2_tl.js";
3
- import { constructWebAppInfo } from "./0_web_app_info.js";
3
+ import { constructMiniAppInfo } from "./0_mini_app_info.js";
4
4
  export function constructInlineKeyboardButton(button_) {
5
5
  if (button_ instanceof types.KeyboardButtonUrl) {
6
6
  return { text: button_.text, url: button_.url };
@@ -9,7 +9,7 @@ export function constructInlineKeyboardButton(button_) {
9
9
  return { text: button_.text, callbackData: new TextDecoder().decode(button_.data) };
10
10
  }
11
11
  else if (button_ instanceof types.KeyboardButtonWebView || button_ instanceof types.KeyboardButtonSimpleWebView) {
12
- return { text: button_.text, webApp: constructWebAppInfo(button_.url) };
12
+ return { text: button_.text, miniApp: constructMiniAppInfo(button_.url) };
13
13
  }
14
14
  else if (button_ instanceof types.KeyboardButtonUrlAuth) {
15
15
  return { text: button_.text, loginUrl: { url: button_.url, forwardText: button_.fwd_text } };
@@ -39,8 +39,8 @@ export async function inlineKeyboardButtonToTlObject(button, usernameResolver) {
39
39
  else if ("callbackData" in button) {
40
40
  return new types.KeyboardButtonCallback({ text: button.text, data: new TextEncoder().encode(button.callbackData) });
41
41
  }
42
- else if ("webApp" in button) {
43
- return new types.KeyboardButtonWebView({ text: button.text, url: button.webApp.url });
42
+ else if ("miniApp" in button) {
43
+ return new types.KeyboardButtonWebView({ text: button.text, url: button.miniApp.url });
44
44
  }
45
45
  else if ("loginUrl" in button) {
46
46
  return new types.InputKeyboardButtonUrlAuth({
@@ -2,6 +2,7 @@ import { types } from "../2_tl.js";
2
2
  import { Location } from "./0_location.js";
3
3
  import { EntityGetter } from "./1__getters.js";
4
4
  import { User } from "./1_user.js";
5
+ /** An incoming inline query. */
5
6
  export interface InlineQuery {
6
7
  id: string;
7
8
  from: User;
@@ -0,0 +1,23 @@
1
+ import { types } from "../2_tl.js";
2
+ import { EntityGetter } from "./1__getters.js";
3
+ import { User } from "./1_user.js";
4
+ /** A chat invite link. */
5
+ export interface InviteLink {
6
+ /** The link itself. */
7
+ inviteLink: string;
8
+ /** The user who created the invite link. */
9
+ creator: User;
10
+ /** Whether the invite link requires explicit approval from administrators. */
11
+ createsJoinRequest: boolean;
12
+ /** Whether the invite link is revoked. */
13
+ revoked: boolean;
14
+ /** An optional name. */
15
+ name?: string;
16
+ /** The point of time in which the invite link is expired at. */
17
+ expiresAt?: Date;
18
+ /** The number of times the invite link can be used. */
19
+ limit?: number;
20
+ /** The number of pending join requests from this invite link. */
21
+ pendingJoinRequestCount?: number;
22
+ }
23
+ export declare function constructInviteLink(inviteLink_: types.ChatInviteExported, getEntity: EntityGetter): Promise<InviteLink>;
@@ -0,0 +1,27 @@
1
+ import { cleanObject, fromUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
2
+ import { types } from "../2_tl.js";
3
+ import { constructUser } from "./1_user.js";
4
+ export async function constructInviteLink(inviteLink_, getEntity) {
5
+ const entity = await getEntity(new types.PeerUser({ user_id: inviteLink_.admin_id }));
6
+ if (!entity) {
7
+ UNREACHABLE();
8
+ }
9
+ const inviteLink = inviteLink_.link;
10
+ const creator = constructUser(entity);
11
+ const createsJoinRequest = inviteLink_.request_needed ? true : false;
12
+ const revoked = inviteLink_.revoked ? true : false;
13
+ const name = inviteLink_.title;
14
+ const expiresAt = inviteLink_.expire_date ? fromUnixTimestamp(inviteLink_.expire_date) : undefined;
15
+ const limit = inviteLink_.usage_limit ? inviteLink_.usage_limit : undefined;
16
+ const pendingJoinRequestCount = inviteLink_.requested;
17
+ return cleanObject({
18
+ inviteLink,
19
+ creator,
20
+ createsJoinRequest,
21
+ revoked,
22
+ name,
23
+ expiresAt,
24
+ limit,
25
+ pendingJoinRequestCount,
26
+ });
27
+ }
@@ -2,6 +2,7 @@ import { types } from "../2_tl.js";
2
2
  import { EntityGetter } from "./1__getters.js";
3
3
  import { ChatP } from "./1_chat_p.js";
4
4
  import { ReactionCount } from "./1_reaction_count.js";
5
+ /** Information on the reactions made to a channel post. */
5
6
  export interface MessageReactionCount {
6
7
  chat: ChatP;
7
8
  messageId: number;
@@ -0,0 +1,23 @@
1
+ import { types } from "../2_tl.js";
2
+ import { EntityGetter } from "./1__getters.js";
3
+ import { ChatP } from "./1_chat_p.js";
4
+ import { User } from "./1_user.js";
5
+ import { ChatMember } from "./2_chat_member.js";
6
+ import { InviteLink } from "./2_invite_link.js";
7
+ export interface ChatMemberUpdated {
8
+ /** The chat in which the change was made. */
9
+ chat: ChatP;
10
+ /** The one who made the change. */
11
+ from: User;
12
+ /** The point of time in which the chat member's status was changed. */
13
+ date: Date;
14
+ /** The old status of the chat member. */
15
+ oldChatMember: ChatMember;
16
+ /** The new status of the chat member. */
17
+ newChatMember: ChatMember;
18
+ /** The invite link used to join. */
19
+ inviteLink?: InviteLink;
20
+ /** Whether the user joined from a shared folder. */
21
+ viaSharedFolder?: boolean;
22
+ }
23
+ export declare function constructChatMemberUpdated(update: types.UpdateChannelParticipant | types.UpdateChatParticipant, getEntity: EntityGetter): Promise<ChatMemberUpdated>;
@@ -0,0 +1,33 @@
1
+ import { cleanObject, fromUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
2
+ import { types } from "../2_tl.js";
3
+ import { constructChatP } from "./1_chat_p.js";
4
+ import { constructUser } from "./1_user.js";
5
+ import { constructChatMember } from "./2_chat_member.js";
6
+ import { constructInviteLink } from "./2_invite_link.js";
7
+ export async function constructChatMemberUpdated(update, getEntity) {
8
+ if (!update.prev_participant && !update.new_participant) {
9
+ UNREACHABLE();
10
+ }
11
+ const chat_ = await getEntity("channel_id" in update ? new types.PeerChannel(update) : new types.PeerChat(update));
12
+ const from_ = await getEntity(new types.PeerUser({ user_id: update.actor_id }));
13
+ if (!chat_ || !from_) {
14
+ UNREACHABLE();
15
+ }
16
+ const userPeer = new types.PeerUser(update);
17
+ const chat = constructChatP(chat_);
18
+ const from = constructUser(from_);
19
+ const date = fromUnixTimestamp(update.date);
20
+ const oldChatMember = await constructChatMember(update.prev_participant ?? new types.ChannelParticipantLeft({ peer: userPeer }), getEntity);
21
+ const newChatMember = await constructChatMember(update.new_participant ?? new types.ChannelParticipantLeft({ peer: userPeer }), getEntity);
22
+ const viaSharedFolder = "via_chatlist" in update ? update.via_chatlist ? true : update.invite ? false : undefined : undefined;
23
+ const inviteLink = (update.invite && update.invite instanceof types.ChatInviteExported) ? await constructInviteLink(update.invite, getEntity) : undefined;
24
+ return cleanObject({
25
+ chat,
26
+ from,
27
+ date,
28
+ oldChatMember,
29
+ newChatMember,
30
+ viaSharedFolder,
31
+ inviteLink,
32
+ });
33
+ }
@@ -185,6 +185,7 @@ export interface InlineQueryResultVoice extends _InlineQueryResultBase, _InlineQ
185
185
  voiceUrl: string;
186
186
  voiceDuration?: number;
187
187
  }
188
+ /** A single inline query result. */
188
189
  export type InlineQueryResult = InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice;
189
190
  export declare function inlineQueryResultToTlObject(result_: InlineQueryResult, parseText: (text: string, params?: {
190
191
  parseMode?: ParseMode;
@@ -178,7 +178,7 @@ export async function inlineQueryResultToTlObject(result_, parseText, usernameRe
178
178
  const fileId = FileID.decode(fileId_);
179
179
  return new types.InputBotInlineResultDocument({
180
180
  id,
181
- type,
181
+ type: type == "document" ? "file" : type,
182
182
  title,
183
183
  description,
184
184
  document: new types.InputDocument({
@@ -88,7 +88,7 @@ export interface _MessageBase {
88
88
  * Properties shared between media message types.
89
89
  * @unlisted
90
90
  */
91
- export interface MessageMediaBase extends _MessageBase {
91
+ export interface _MessageMediaBase extends _MessageBase {
92
92
  caption?: string;
93
93
  captionEntities?: MessageEntity[];
94
94
  hasMediaSpoiler?: boolean;
@@ -104,7 +104,7 @@ export interface MessageText extends _MessageBase {
104
104
  entities: MessageEntity[];
105
105
  }
106
106
  /** @unlisted */
107
- export interface MessagePhoto extends MessageMediaBase {
107
+ export interface MessagePhoto extends _MessageMediaBase {
108
108
  /** The photo included in the message. */
109
109
  photo: Photo;
110
110
  }
@@ -112,7 +112,7 @@ export interface MessagePhoto extends MessageMediaBase {
112
112
  * A document message.
113
113
  * @unlisted
114
114
  */
115
- export interface MessageDocument extends MessageMediaBase {
115
+ export interface MessageDocument extends _MessageMediaBase {
116
116
  /** The document included in the message. */
117
117
  document: Document;
118
118
  }
@@ -120,7 +120,7 @@ export interface MessageDocument extends MessageMediaBase {
120
120
  * A video message.
121
121
  * @unlisted
122
122
  */
123
- export interface MessageVideo extends MessageMediaBase {
123
+ export interface MessageVideo extends _MessageMediaBase {
124
124
  /** The video included in the message. */
125
125
  video: Video;
126
126
  }
@@ -136,7 +136,7 @@ export interface MessageSticker extends _MessageBase {
136
136
  * An animation message. Animations are GIFs or H.264/MPEG-4 AVC videos without sound.
137
137
  * @unlisted
138
138
  */
139
- export interface MessageAnimation extends MessageMediaBase {
139
+ export interface MessageAnimation extends _MessageMediaBase {
140
140
  /** The animation included in the message. */
141
141
  animation: Animation;
142
142
  }
@@ -144,7 +144,7 @@ export interface MessageAnimation extends MessageMediaBase {
144
144
  * A voice message.
145
145
  * @unlisted
146
146
  */
147
- export interface MessageVoice extends MessageMediaBase {
147
+ export interface MessageVoice extends _MessageMediaBase {
148
148
  /** The voice included in the message. */
149
149
  voice: Voice;
150
150
  }
@@ -152,7 +152,7 @@ export interface MessageVoice extends MessageMediaBase {
152
152
  * An audio message.
153
153
  * @unlisted
154
154
  */
155
- export interface MessageAudio extends MessageMediaBase {
155
+ export interface MessageAudio extends _MessageMediaBase {
156
156
  /** The audio included in the message. */
157
157
  audio: Audio;
158
158
  }
@@ -325,7 +325,7 @@ export interface MessageUserShared extends _MessageBase {
325
325
  */
326
326
  export interface MessageWriteAccessAllowed extends _MessageBase {
327
327
  writeAccessAllowed: {
328
- webAppName?: string;
328
+ miniAppName?: string;
329
329
  };
330
330
  }
331
331
  /**
@@ -197,8 +197,8 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
197
197
  return { ...message, userShared };
198
198
  }
199
199
  else if (message_.action instanceof types.MessageActionBotAllowed) {
200
- const webAppName = message_.action.app ? message_.action.app[as](types.BotApp).title : undefined;
201
- const writeAccessAllowed = { webAppName };
200
+ const miniAppName = message_.action.app ? message_.action.app[as](types.BotApp).title : undefined;
201
+ const writeAccessAllowed = { miniAppName };
202
202
  return { ...message, writeAccessAllowed };
203
203
  }
204
204
  else if (message_.action instanceof types.MessageActionTopicCreate) {