@mtkruto/node 0.0.832 → 0.0.835

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 (127) hide show
  1. package/esm/client/client.d.ts +7 -2
  2. package/esm/client/client.js +66 -13
  3. package/esm/client/client_abstract.d.ts +2 -2
  4. package/esm/client/client_abstract.js +3 -8
  5. package/esm/client/client_plain.js +8 -7
  6. package/esm/connection/connection.d.ts +2 -1
  7. package/esm/connection/connection_web_socket.d.ts +1 -0
  8. package/esm/connection/connection_web_socket.js +3 -0
  9. package/esm/deps/deno.land/std@0.69.0/fmt/colors.d.ts +77 -0
  10. package/esm/deps/deno.land/std@0.69.0/fmt/colors.js +224 -0
  11. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/colors.d.ts +3 -0
  12. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/colors.js +71 -0
  13. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/debug.d.ts +22 -0
  14. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/debug.js +112 -0
  15. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/deps.d.ts +2 -0
  16. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/deps.js +2 -0
  17. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/format.d.ts +1 -0
  18. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/format.js +39 -0
  19. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/mod.d.ts +1 -0
  20. package/esm/deps/raw.githubusercontent.com/MTKruto/debug/master/mod.js +1 -0
  21. package/esm/deps.d.ts +2 -0
  22. package/esm/deps.js +2 -0
  23. package/esm/storage/storage.d.ts +1 -1
  24. package/esm/storage/storage_local_storage.d.ts +1 -1
  25. package/esm/storage/storage_memory.d.ts +1 -1
  26. package/esm/storage/storage_session_storage.d.ts +1 -1
  27. package/esm/transport/transport.d.ts +1 -1
  28. package/esm/types/0_chat_administrator_rights.d.ts +17 -0
  29. package/esm/types/0_chat_administrator_rights.js +38 -0
  30. package/esm/types/0_chat_photo.d.ts +24 -0
  31. package/esm/types/0_chat_photo.js +28 -0
  32. package/esm/types/0_force_reply.d.ts +8 -0
  33. package/esm/types/0_force_reply.js +17 -0
  34. package/esm/types/0_keyboard_button_poll_type.d.ts +3 -0
  35. package/esm/types/0_login_url.d.ts +6 -0
  36. package/esm/types/0_login_url.js +1 -0
  37. package/esm/types/0_message_entity.d.ts +1 -1
  38. package/esm/types/0_message_entity.js +2 -2
  39. package/esm/types/0_reply_keyboard_remove.d.ts +7 -0
  40. package/esm/types/0_reply_keyboard_remove.js +8 -0
  41. package/esm/types/0_web_app_info.d.ts +4 -0
  42. package/esm/types/0_web_app_info.js +3 -0
  43. package/esm/types/1_chat.d.ts +60 -0
  44. package/esm/types/1_chat.js +70 -0
  45. package/esm/types/1_inline_keyboard_button.d.ts +33 -0
  46. package/esm/types/1_inline_keyboard_button.js +63 -0
  47. package/esm/types/1_keyboard_button.d.ts +43 -0
  48. package/esm/types/1_keyboard_button.js +133 -0
  49. package/esm/types/1_user.d.ts +19 -0
  50. package/esm/types/1_user.js +25 -0
  51. package/esm/types/2_inline_keyboard_markup.d.ts +7 -0
  52. package/esm/types/2_inline_keyboard_markup.js +25 -0
  53. package/esm/types/2_reply_keyboard_markup.d.ts +12 -0
  54. package/esm/types/2_reply_keyboard_markup.js +37 -0
  55. package/esm/types/3_message.d.ts +22 -0
  56. package/esm/types/3_message.js +87 -0
  57. package/esm/utilities/0_control.d.ts +1 -0
  58. package/esm/utilities/0_control.js +3 -0
  59. package/esm/utilities/0_object.d.ts +1 -0
  60. package/esm/utilities/0_object.js +14 -0
  61. package/esm/utilities/0_types.js +1 -0
  62. package/package.json +8 -6
  63. package/script/client/client.d.ts +7 -2
  64. package/script/client/client.js +65 -12
  65. package/script/client/client_abstract.d.ts +2 -2
  66. package/script/client/client_abstract.js +3 -8
  67. package/script/client/client_plain.js +7 -6
  68. package/script/connection/connection.d.ts +2 -1
  69. package/script/connection/connection_web_socket.d.ts +1 -0
  70. package/script/connection/connection_web_socket.js +3 -0
  71. package/script/deps/deno.land/std@0.69.0/fmt/colors.d.ts +77 -0
  72. package/script/deps/deno.land/std@0.69.0/fmt/colors.js +298 -0
  73. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/colors.d.ts +3 -0
  74. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/colors.js +98 -0
  75. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/debug.d.ts +22 -0
  76. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/debug.js +141 -0
  77. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/deps.d.ts +2 -0
  78. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/deps.js +32 -0
  79. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/format.d.ts +1 -0
  80. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/format.js +43 -0
  81. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/mod.d.ts +1 -0
  82. package/script/deps/raw.githubusercontent.com/MTKruto/debug/master/mod.js +17 -0
  83. package/script/deps.d.ts +2 -0
  84. package/script/deps.js +4 -1
  85. package/script/storage/storage.d.ts +1 -1
  86. package/script/storage/storage_local_storage.d.ts +1 -1
  87. package/script/storage/storage_memory.d.ts +1 -1
  88. package/script/storage/storage_session_storage.d.ts +1 -1
  89. package/script/transport/transport.d.ts +1 -1
  90. package/script/types/0_chat_administrator_rights.d.ts +17 -0
  91. package/script/types/0_chat_administrator_rights.js +66 -0
  92. package/script/types/0_chat_photo.d.ts +24 -0
  93. package/script/types/0_chat_photo.js +55 -0
  94. package/script/types/0_force_reply.d.ts +8 -0
  95. package/script/types/0_force_reply.js +45 -0
  96. package/script/types/0_keyboard_button_poll_type.d.ts +3 -0
  97. package/script/types/0_login_url.d.ts +6 -0
  98. package/script/types/0_login_url.js +2 -0
  99. package/script/types/0_message_entity.d.ts +1 -1
  100. package/script/types/0_message_entity.js +2 -2
  101. package/script/types/0_reply_keyboard_remove.d.ts +7 -0
  102. package/script/types/0_reply_keyboard_remove.js +36 -0
  103. package/script/types/0_web_app_info.d.ts +4 -0
  104. package/script/types/0_web_app_info.js +7 -0
  105. package/script/types/1_chat.d.ts +60 -0
  106. package/script/types/1_chat.js +97 -0
  107. package/script/types/1_inline_keyboard_button.d.ts +33 -0
  108. package/script/types/1_inline_keyboard_button.js +91 -0
  109. package/script/types/1_keyboard_button.d.ts +43 -0
  110. package/script/types/1_keyboard_button.js +161 -0
  111. package/script/types/1_user.d.ts +19 -0
  112. package/script/types/1_user.js +52 -0
  113. package/script/types/2_inline_keyboard_markup.d.ts +7 -0
  114. package/script/types/2_inline_keyboard_markup.js +53 -0
  115. package/script/types/2_reply_keyboard_markup.d.ts +12 -0
  116. package/script/types/2_reply_keyboard_markup.js +65 -0
  117. package/script/types/3_message.d.ts +22 -0
  118. package/script/types/3_message.js +114 -0
  119. package/script/utilities/0_control.d.ts +1 -0
  120. package/script/utilities/0_control.js +7 -0
  121. package/script/utilities/0_object.d.ts +1 -0
  122. package/script/utilities/0_object.js +18 -0
  123. package/script/utilities/0_types.js +2 -0
  124. /package/esm/{types.js → types/0_keyboard_button_poll_type.js} +0 -0
  125. /package/esm/{types.d.ts → utilities/0_types.d.ts} +0 -0
  126. /package/script/{types.js → types/0_keyboard_button_poll_type.js} +0 -0
  127. /package/script/{types.d.ts → utilities/0_types.d.ts} +0 -0
package/script/deps.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Parser = exports.Mutex = exports.gzip = exports.gunzip = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.factorize = exports.ctr256Encrypt = exports.ctr256Decrypt = void 0;
17
+ exports.debug = exports.Parser = exports.Mutex = exports.gzip = exports.gunzip = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.factorize = exports.ctr256Encrypt = exports.ctr256Decrypt = void 0;
18
18
  __exportStar(require("./deps/deno.land/std@0.190.0/testing/asserts.js"), exports);
19
19
  var mod_js_1 = require("./deps/deno.land/x/tgcrypto@0.1.3/mod.js");
20
20
  Object.defineProperty(exports, "ctr256Decrypt", { enumerable: true, get: function () { return mod_js_1.ctr256Decrypt; } });
@@ -30,3 +30,6 @@ var async_mutex_1 = require("async-mutex");
30
30
  Object.defineProperty(exports, "Mutex", { enumerable: true, get: function () { return async_mutex_1.Mutex; } });
31
31
  var mod_js_2 = require("./deps/deno.land/x/html_parser@v0.1.3/src/mod.js");
32
32
  Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return mod_js_2.Parser; } });
33
+ const mod_js_3 = require("./deps/raw.githubusercontent.com/MTKruto/debug/master/mod.js");
34
+ const debug = (v) => (0, mod_js_3.debug)(`mtkruto__${v}`);
35
+ exports.debug = debug;
@@ -1,4 +1,4 @@
1
- import { MaybePromise } from "../types.js";
1
+ import { MaybePromise } from "../utilities/0_types.js";
2
2
  import { DC } from "../transport/transport_provider.js";
3
3
  export declare abstract class Storage {
4
4
  private _authKeyId;
@@ -1,4 +1,4 @@
1
- import { MaybePromise } from "../types.js";
1
+ import { MaybePromise } from "../utilities/0_types.js";
2
2
  import { Storage } from "./storage.js";
3
3
  export declare class StorageLocalStorage extends Storage implements Storage {
4
4
  private readonly prefix;
@@ -1,4 +1,4 @@
1
- import { MaybePromise } from "../types.js";
1
+ import { MaybePromise } from "../utilities/0_types.js";
2
2
  import { Storage } from "./storage.js";
3
3
  export declare class StorageMemory extends Storage implements Storage {
4
4
  protected map: Map<string, string>;
@@ -1,4 +1,4 @@
1
- import { MaybePromise } from "../types.js";
1
+ import { MaybePromise } from "../utilities/0_types.js";
2
2
  import { Storage } from "./storage.js";
3
3
  export declare class StorageSessionStorage extends Storage implements Storage {
4
4
  private readonly prefix;
@@ -1,4 +1,4 @@
1
- import { MaybePromise } from "../types.js";
1
+ import { MaybePromise } from "../utilities/0_types.js";
2
2
  import { CTR } from "../utilities/0_crypto.js";
3
3
  export declare abstract class Transport {
4
4
  protected initialized: boolean;
@@ -0,0 +1,17 @@
1
+ import * as types from "../tl/2_types.js";
2
+ export interface ChatAdministratorRights {
3
+ isAnonymous: boolean;
4
+ canManageChat: boolean;
5
+ canDeleteMessages: boolean;
6
+ canManageVideoChats: boolean;
7
+ canRestrictMembers: boolean;
8
+ canPromoteMembers: boolean;
9
+ canChangeInfo: boolean;
10
+ canInviteUsers: boolean;
11
+ canPostMessages?: boolean;
12
+ canEditMessages?: boolean;
13
+ canPinMessages?: boolean;
14
+ canManageTopics?: boolean;
15
+ }
16
+ export declare function constructChatAdministratorRights(rights_: types.ChatAdminRights): ChatAdministratorRights;
17
+ export declare function chatAdministratorRightsToTlObject(rights: ChatAdministratorRights): types.ChatAdminRights;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.chatAdministratorRightsToTlObject = exports.constructChatAdministratorRights = void 0;
27
+ const types = __importStar(require("../tl/2_types.js"));
28
+ function constructChatAdministratorRights(rights_) {
29
+ const rights = {
30
+ isAnonymous: rights_.anonymous || false,
31
+ canManageChat: rights_.other || false,
32
+ canDeleteMessages: rights_.deleteMessages || false,
33
+ canManageVideoChats: rights_.manageCall || false,
34
+ canRestrictMembers: rights_.banUsers || false,
35
+ canPromoteMembers: rights_.addAdmins || false,
36
+ canChangeInfo: rights_.changeInfo || false,
37
+ canInviteUsers: rights_.inviteUsers || false,
38
+ };
39
+ if (rights_.postMessages) {
40
+ rights.canPostMessages = rights_.postMessages;
41
+ }
42
+ if (rights_.editMessages) {
43
+ rights.canEditMessages = rights_.editMessages;
44
+ }
45
+ if (rights_.pinMessages) {
46
+ rights.canPinMessages = rights_.pinMessages;
47
+ }
48
+ if (rights_.manageTopics) {
49
+ rights.canManageTopics = rights_.manageTopics;
50
+ }
51
+ return rights;
52
+ }
53
+ exports.constructChatAdministratorRights = constructChatAdministratorRights;
54
+ function chatAdministratorRightsToTlObject(rights) {
55
+ return new types.ChatAdminRights({
56
+ anonymous: rights.isAnonymous || undefined,
57
+ other: rights.canManageChat || undefined,
58
+ deleteMessages: rights.canDeleteMessages || undefined,
59
+ manageCall: rights.canManageChat || undefined,
60
+ banUsers: rights.canRestrictMembers || undefined,
61
+ addAdmins: rights.canPromoteMembers || undefined,
62
+ changeInfo: rights.canChangeInfo || undefined,
63
+ inviteUsers: rights.canInviteUsers || undefined,
64
+ });
65
+ }
66
+ exports.chatAdministratorRightsToTlObject = chatAdministratorRightsToTlObject;
@@ -0,0 +1,24 @@
1
+ import * as types from "../tl/2_types.js";
2
+ export declare enum ChatPhotoType {
3
+ Chat = "chat",
4
+ User = "user"
5
+ }
6
+ export declare namespace ChatPhoto {
7
+ interface Base {
8
+ type: ChatPhotoType;
9
+ hasVideo: boolean;
10
+ photoId: bigint;
11
+ strippedThumb?: Uint8Array;
12
+ dcId: number;
13
+ }
14
+ interface User extends Base {
15
+ type: ChatPhotoType;
16
+ personal: boolean;
17
+ }
18
+ interface Chat extends Base {
19
+ type: ChatPhotoType;
20
+ }
21
+ }
22
+ export type ChatPhoto = ChatPhoto.User | ChatPhoto.Chat;
23
+ export declare function constructChatPhoto(photo: types.ChatPhoto): ChatPhoto.Chat;
24
+ export declare function constructChatPhoto(photo: types.UserProfilePhoto): ChatPhoto.User;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.constructChatPhoto = exports.ChatPhotoType = void 0;
27
+ const types = __importStar(require("../tl/2_types.js"));
28
+ var ChatPhotoType;
29
+ (function (ChatPhotoType) {
30
+ ChatPhotoType["Chat"] = "chat";
31
+ ChatPhotoType["User"] = "user";
32
+ })(ChatPhotoType = exports.ChatPhotoType || (exports.ChatPhotoType = {}));
33
+ function constructChatPhoto(photo) {
34
+ const { hasVideo = false, photoId, strippedThumb, dcId } = photo;
35
+ if (photo instanceof types.ChatPhoto) {
36
+ return {
37
+ type: ChatPhotoType.Chat,
38
+ hasVideo,
39
+ photoId,
40
+ strippedThumb,
41
+ dcId,
42
+ };
43
+ }
44
+ else {
45
+ return {
46
+ type: ChatPhotoType.User,
47
+ personal: photo.personal || false,
48
+ hasVideo,
49
+ photoId,
50
+ strippedThumb,
51
+ dcId,
52
+ };
53
+ }
54
+ }
55
+ exports.constructChatPhoto = constructChatPhoto;
@@ -0,0 +1,8 @@
1
+ import * as types from "../tl/2_types.js";
2
+ export interface ForceReply {
3
+ forceReply: true;
4
+ inputFieldPlaceholder?: string;
5
+ selective?: boolean;
6
+ }
7
+ export declare function constructForceReply(replyMarkup_: types.ReplyKeyboardForceReply): ForceReply;
8
+ export declare function forceReplyToTlObject(replyMarkup: ForceReply): types.ReplyKeyboardForceReply;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.forceReplyToTlObject = exports.constructForceReply = void 0;
27
+ const types = __importStar(require("../tl/2_types.js"));
28
+ function constructForceReply(replyMarkup_) {
29
+ const replyMarkup = { forceReply: true };
30
+ if (replyMarkup_.placeholder) {
31
+ replyMarkup.inputFieldPlaceholder = replyMarkup_.placeholder;
32
+ }
33
+ if (replyMarkup_.selective) {
34
+ replyMarkup.selective = true;
35
+ }
36
+ return replyMarkup;
37
+ }
38
+ exports.constructForceReply = constructForceReply;
39
+ function forceReplyToTlObject(replyMarkup) {
40
+ return new types.ReplyKeyboardForceReply({
41
+ selective: replyMarkup.selective || undefined,
42
+ placeholder: replyMarkup.inputFieldPlaceholder,
43
+ });
44
+ }
45
+ exports.forceReplyToTlObject = forceReplyToTlObject;
@@ -0,0 +1,3 @@
1
+ export interface KeyboardButtonPollType {
2
+ type?: string;
3
+ }
@@ -0,0 +1,6 @@
1
+ export interface LoginUrl {
2
+ url: string;
3
+ forwardText?: string;
4
+ botUsername?: string;
5
+ requestWriteAccess?: boolean;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -84,7 +84,7 @@ export declare namespace MessageEntity {
84
84
  }
85
85
  interface CustomEmoji extends Base {
86
86
  type: MessageEntityType.CustomEmoji;
87
- documentId: bigint;
87
+ customEmojiId: string;
88
88
  }
89
89
  }
90
90
  export type MessageEntity = MessageEntity.Mention | MessageEntity.Hashtag | MessageEntity.BotCommand | MessageEntity.URL | MessageEntity.EmailAddress | MessageEntity.Bold | MessageEntity.Italic | MessageEntity.Code | MessageEntity.Pre | MessageEntity.TextURL | MessageEntity.MentionName | MessageEntity.Cashtag | MessageEntity.Phone | MessageEntity.Underline | MessageEntity.Strike | MessageEntity.Blockquote | MessageEntity.BankCard | MessageEntity.Spoiler | MessageEntity.CustomEmoji;
@@ -103,7 +103,7 @@ function constructMessageEntity(obj) {
103
103
  return { type: MessageEntityType.Spoiler, offset: obj.offset, length: obj.length };
104
104
  }
105
105
  else if (obj instanceof types.MessageEntityCustomEmoji) {
106
- return { type: MessageEntityType.CustomEmoji, offset: obj.offset, length: obj.length, documentId: obj.documentId };
106
+ return { type: MessageEntityType.CustomEmoji, offset: obj.offset, length: obj.length, customEmojiId: String(obj.documentId) };
107
107
  }
108
108
  else {
109
109
  return null;
@@ -150,7 +150,7 @@ function messageEntityToTlObject(entity) {
150
150
  case MessageEntityType.Spoiler:
151
151
  return new types.MessageEntitySpoiler({ offset, length });
152
152
  case MessageEntityType.CustomEmoji:
153
- return new types.MessageEntityCustomEmoji({ offset, length, documentId: entity.documentId });
153
+ return new types.MessageEntityCustomEmoji({ offset, length, documentId: BigInt(entity.customEmojiId) });
154
154
  }
155
155
  }
156
156
  exports.messageEntityToTlObject = messageEntityToTlObject;
@@ -0,0 +1,7 @@
1
+ import * as types from "../tl/2_types.js";
2
+ export interface ReplyKeyboardRemove {
3
+ removeKeyboard: true;
4
+ selective?: boolean;
5
+ }
6
+ export declare function constructReplyKeyboardRemove(replyMarkup_: types.ReplyKeyboardHide): ReplyKeyboardRemove;
7
+ export declare function replyKeyboardRemoveToTlObject(replyMarkup: ReplyKeyboardRemove): types.ReplyKeyboardHide;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.replyKeyboardRemoveToTlObject = exports.constructReplyKeyboardRemove = void 0;
27
+ const _0_object_js_1 = require("../utilities/0_object.js");
28
+ const types = __importStar(require("../tl/2_types.js"));
29
+ function constructReplyKeyboardRemove(replyMarkup_) {
30
+ return (0, _0_object_js_1.cleanObject)({ removeKeyboard: true, selective: replyMarkup_.selective });
31
+ }
32
+ exports.constructReplyKeyboardRemove = constructReplyKeyboardRemove;
33
+ function replyKeyboardRemoveToTlObject(replyMarkup) {
34
+ return new types.ReplyKeyboardHide({ selective: replyMarkup.selective || undefined });
35
+ }
36
+ exports.replyKeyboardRemoveToTlObject = replyKeyboardRemoveToTlObject;
@@ -0,0 +1,4 @@
1
+ export interface WebAppInfo {
2
+ url: string;
3
+ }
4
+ export declare function constructWebAppInfo(url: string): WebAppInfo;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.constructWebAppInfo = void 0;
4
+ function constructWebAppInfo(url) {
5
+ return { url };
6
+ }
7
+ exports.constructWebAppInfo = constructWebAppInfo;
@@ -0,0 +1,60 @@
1
+ import * as types from "../tl/2_types.js";
2
+ import { ChatPhoto } from "./0_chat_photo.js";
3
+ export declare enum ChatType {
4
+ Private = "private",
5
+ Group = "group",
6
+ Supergroup = "supergroup",
7
+ Channel = "channel"
8
+ }
9
+ export declare namespace Chat {
10
+ interface Base {
11
+ type: ChatType;
12
+ id: number;
13
+ photo?: ChatPhoto;
14
+ }
15
+ interface Private extends Base {
16
+ type: ChatType.Private;
17
+ isBot?: boolean;
18
+ firstName: string;
19
+ lastName?: string;
20
+ username?: string;
21
+ also?: string[];
22
+ photo?: ChatPhoto.User;
23
+ isScam: boolean;
24
+ isFake: boolean;
25
+ isSupport: boolean;
26
+ isVerified: boolean;
27
+ isRestricted?: boolean;
28
+ restrictionReason?: types.RestrictionReason[];
29
+ }
30
+ interface Group extends Base {
31
+ type: ChatType.Group;
32
+ title: string;
33
+ photo?: ChatPhoto.Chat;
34
+ isCreator: boolean;
35
+ }
36
+ interface ChannelBase extends Base {
37
+ title: string;
38
+ username?: string;
39
+ also?: string[];
40
+ photo?: ChatPhoto.Chat;
41
+ isScam: boolean;
42
+ isFake: boolean;
43
+ isVerified: boolean;
44
+ isRestricted: boolean;
45
+ restrictionReason?: types.RestrictionReason[];
46
+ }
47
+ interface Channel extends ChannelBase {
48
+ type: ChatType.Channel;
49
+ title: string;
50
+ username?: string;
51
+ also?: string[];
52
+ }
53
+ interface Supergroup extends ChannelBase {
54
+ type: ChatType.Supergroup;
55
+ }
56
+ }
57
+ export type Chat = Chat.Private | Chat.Group | Chat.Supergroup | Chat.Channel;
58
+ export declare function constructChat(chat: types.User): Chat.Private;
59
+ export declare function constructChat(chat: types.Chat): Chat.Group;
60
+ export declare function constructChat(chat: types.Channel): Chat.Supergroup | Chat.Channel;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.constructChat = exports.ChatType = void 0;
27
+ const constants_js_1 = require("../constants.js");
28
+ const _0_control_js_1 = require("../utilities/0_control.js");
29
+ const _0_object_js_1 = require("../utilities/0_object.js");
30
+ const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
31
+ const types = __importStar(require("../tl/2_types.js"));
32
+ const _0_chat_photo_js_1 = require("./0_chat_photo.js");
33
+ var ChatType;
34
+ (function (ChatType) {
35
+ ChatType["Private"] = "private";
36
+ ChatType["Group"] = "group";
37
+ ChatType["Supergroup"] = "supergroup";
38
+ ChatType["Channel"] = "channel";
39
+ })(ChatType = exports.ChatType || (exports.ChatType = {}));
40
+ function constructChat(chat) {
41
+ if (chat instanceof types.User) {
42
+ const chat_ = {
43
+ type: ChatType.Private,
44
+ isBot: chat.bot || false,
45
+ id: Number(chat.id),
46
+ firstName: chat.firstName || "",
47
+ lastName: chat.lastName,
48
+ isScam: chat.scam || false,
49
+ isFake: chat.fake || false,
50
+ isSupport: chat.support || false,
51
+ isVerified: chat.verified || false,
52
+ };
53
+ if (chat_.isBot) {
54
+ chat_.isRestricted = chat.restricted || false;
55
+ chat_.restrictionReason = chat.restrictionReason?.map((v) => v[_1_tl_object_js_1.as](types.RestrictionReason));
56
+ }
57
+ if (chat.photo instanceof types.UserProfilePhoto) {
58
+ chat_.photo = (0, _0_chat_photo_js_1.constructChatPhoto)(chat.photo);
59
+ }
60
+ return (0, _0_object_js_1.cleanObject)(chat_);
61
+ }
62
+ else if (chat instanceof types.Chat) {
63
+ const chat_ = {
64
+ type: ChatType.Group,
65
+ id: Number(-chat.id),
66
+ title: chat.title,
67
+ isCreator: chat.creator || false,
68
+ };
69
+ if (chat.photo instanceof types.ChatPhoto) {
70
+ chat_.photo = (0, _0_chat_photo_js_1.constructChatPhoto)(chat.photo);
71
+ }
72
+ return (0, _0_object_js_1.cleanObject)(chat_);
73
+ }
74
+ else if (chat instanceof types.Channel) {
75
+ let chat_;
76
+ const { title, scam: isScam = false, fake: isFake = false, verified: isVerified = false, restricted: isRestricted = false, } = chat;
77
+ if (chat.megagroup) {
78
+ chat_ = { id: constants_js_1.ZERO_CHANNEL_ID + -Number(chat.id), type: ChatType.Supergroup, title, isScam, isFake, isVerified, isRestricted };
79
+ }
80
+ else {
81
+ chat_ = { id: constants_js_1.ZERO_CHANNEL_ID + -Number(chat.id), type: ChatType.Channel, title, isScam, isFake, isVerified, isRestricted };
82
+ }
83
+ chat_.username = chat.username;
84
+ chat_.also = chat.usernames?.map((v) => v[_1_tl_object_js_1.as](types.Username)).map((v) => v.username);
85
+ if (chat_.isRestricted) {
86
+ chat_.restrictionReason = chat.restrictionReason?.map((v) => v[_1_tl_object_js_1.as](types.RestrictionReason));
87
+ }
88
+ if (chat.photo instanceof types.ChatPhoto) {
89
+ chat_.photo = (0, _0_chat_photo_js_1.constructChatPhoto)(chat.photo);
90
+ }
91
+ return (0, _0_object_js_1.cleanObject)(chat_);
92
+ }
93
+ else {
94
+ (0, _0_control_js_1.UNREACHABLE)();
95
+ }
96
+ }
97
+ exports.constructChat = constructChat;
@@ -0,0 +1,33 @@
1
+ import { MaybePromise } from "../utilities/0_types.js";
2
+ import * as types from "../tl/2_types.js";
3
+ import { WebAppInfo } from "./0_web_app_info.js";
4
+ import { LoginUrl } from "./0_login_url.js";
5
+ export declare namespace InlineKeyboardButton {
6
+ interface Base {
7
+ text: string;
8
+ }
9
+ interface URL extends Base {
10
+ url: string;
11
+ }
12
+ interface Callback extends Base {
13
+ callbackData: string;
14
+ }
15
+ interface WebApp extends Base {
16
+ webApp: WebAppInfo;
17
+ }
18
+ interface Login extends Base {
19
+ loginUrl: LoginUrl;
20
+ }
21
+ interface SwitchInline extends Base {
22
+ switchInlineQuery: string;
23
+ }
24
+ interface SwitchInlineCurrent extends Base {
25
+ switchInlineQueryCurrentChat: string;
26
+ }
27
+ interface Pay extends Base {
28
+ pay: boolean;
29
+ }
30
+ }
31
+ export type InlineKeyboardButton = InlineKeyboardButton.URL | InlineKeyboardButton.Callback | InlineKeyboardButton.WebApp | InlineKeyboardButton.Login | InlineKeyboardButton.SwitchInline | InlineKeyboardButton.SwitchInlineCurrent | InlineKeyboardButton.Pay;
32
+ export declare function constructInlineKeyboardButton(button_: types.TypeKeyboardButton): InlineKeyboardButton;
33
+ export declare function inlineKeyboardButtonToTlObject(button: InlineKeyboardButton, usernameResolver: (username: string) => MaybePromise<types.InputUser>): Promise<types.KeyboardButtonURL | types.KeyboardButtonCallback | types.KeyboardButtonSwitchInline | types.KeyboardButtonBuy | types.InputKeyboardButtonURLAuth | types.KeyboardButtonWebView>;