@mtkruto/node 0.1.157 → 0.1.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/4_constants.d.ts +2 -2
- package/esm/4_constants.js +2 -2
- package/esm/client/1_composer.d.ts +2 -2
- package/esm/client/1_composer.js +4 -4
- package/esm/client/1_file_manager.js +53 -56
- package/esm/client/2_message_manager.js +8 -11
- package/esm/client/4_client.d.ts +2 -2
- package/esm/client/4_client.js +4 -4
- package/esm/tl/2_types.d.ts +596 -1
- package/esm/tl/2_types.js +1824 -319
- package/esm/tl/3_functions.d.ts +374 -2
- package/esm/tl/3_functions.js +943 -31
- package/esm/types/0__file_id.d.ts +79 -54
- package/esm/types/0__file_id.js +259 -277
- package/esm/types/0_chat_photo.js +15 -21
- package/esm/types/0_giveaway_parameters.d.ts +5 -0
- package/esm/types/0_login_url.d.ts +4 -0
- package/esm/types/0_message_reference.d.ts +2 -0
- package/esm/types/0_price_tag.d.ts +2 -0
- package/esm/types/0_thumbnail.js +16 -14
- package/esm/types/1_giveaway.d.ts +2 -0
- package/esm/types/1_inline_query_result_button.d.ts +3 -0
- package/esm/types/1_photo.js +20 -14
- package/esm/types/1_poll.d.ts +13 -0
- package/esm/types/1_reaction_count.d.ts +2 -0
- package/esm/types/1_reply_quote.d.ts +3 -0
- package/esm/types/1_user.d.ts +13 -13
- package/esm/types/2_chosen_inline_result.d.ts +5 -0
- package/esm/types/2_game.d.ts +6 -0
- package/esm/types/2_game.js +11 -7
- package/esm/types/2_inactive_chat.d.ts +3 -0
- package/esm/types/2_inline_query.d.ts +6 -0
- package/esm/types/2_message_interactions.d.ts +5 -0
- package/esm/types/2_message_reaction_count.d.ts +4 -0
- package/esm/types/2_message_reactions.d.ts +7 -0
- package/esm/types/2_story_content.js +4 -7
- package/esm/types/4_inline_query_result.js +5 -5
- package/esm/types/4_message.js +24 -19
- package/esm/types/5_callback_query.d.ts +7 -0
- package/esm/utilities/0_buffer.d.ts +1 -1
- package/esm/utilities/0_buffer.js +26 -24
- package/package.json +1 -1
- package/script/4_constants.d.ts +2 -2
- package/script/4_constants.js +2 -2
- package/script/client/1_composer.d.ts +2 -2
- package/script/client/1_composer.js +4 -4
- package/script/client/1_file_manager.js +52 -55
- package/script/client/2_message_manager.js +6 -9
- package/script/client/4_client.d.ts +2 -2
- package/script/client/4_client.js +4 -4
- package/script/tl/2_types.d.ts +596 -1
- package/script/tl/2_types.js +1904 -345
- package/script/tl/3_functions.d.ts +374 -2
- package/script/tl/3_functions.js +977 -41
- package/script/types/0__file_id.d.ts +79 -54
- package/script/types/0__file_id.js +263 -280
- package/script/types/0_chat_photo.js +14 -20
- package/script/types/0_giveaway_parameters.d.ts +5 -0
- package/script/types/0_login_url.d.ts +4 -0
- package/script/types/0_message_reference.d.ts +2 -0
- package/script/types/0_price_tag.d.ts +2 -0
- package/script/types/0_thumbnail.js +15 -13
- package/script/types/1_giveaway.d.ts +2 -0
- package/script/types/1_inline_query_result_button.d.ts +3 -0
- package/script/types/1_photo.js +19 -13
- package/script/types/1_poll.d.ts +13 -0
- package/script/types/1_reaction_count.d.ts +2 -0
- package/script/types/1_reply_quote.d.ts +3 -0
- package/script/types/1_user.d.ts +13 -13
- package/script/types/2_chosen_inline_result.d.ts +5 -0
- package/script/types/2_game.d.ts +6 -0
- package/script/types/2_game.js +10 -6
- package/script/types/2_inactive_chat.d.ts +3 -0
- package/script/types/2_inline_query.d.ts +6 -0
- package/script/types/2_message_interactions.d.ts +5 -0
- package/script/types/2_message_reaction_count.d.ts +4 -0
- package/script/types/2_message_reactions.d.ts +7 -0
- package/script/types/2_story_content.js +3 -6
- package/script/types/4_inline_query_result.js +4 -4
- package/script/types/4_message.js +23 -18
- package/script/types/5_callback_query.d.ts +7 -0
- package/script/utilities/0_buffer.d.ts +1 -1
- package/script/utilities/0_buffer.js +26 -24
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/** A login URL. */
|
|
2
2
|
export interface LoginUrl {
|
|
3
|
+
/** The login URL. */
|
|
3
4
|
url: string;
|
|
5
|
+
/** A different text for the login button that will be shown when the message is forwarded. */
|
|
4
6
|
forwardText?: string;
|
|
7
|
+
/** The username of the bot that performs the authorization. */
|
|
5
8
|
botUsername?: string;
|
|
9
|
+
/** Whether logging in will allow the bot to privately message the user. */
|
|
6
10
|
requestWriteAccess?: boolean;
|
|
7
11
|
}
|
|
@@ -5,20 +5,22 @@ const _2_tl_js_1 = require("../2_tl.js");
|
|
|
5
5
|
const _0__file_id_js_1 = require("./0__file_id.js");
|
|
6
6
|
function constructThumbnail(size, file) {
|
|
7
7
|
const fileType = file instanceof _2_tl_js_1.types.Photo ? _0__file_id_js_1.FileType.Photo : _0__file_id_js_1.FileType.Document;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const fileId_ = file instanceof _2_tl_js_1.types.Photo
|
|
9
|
+
? {
|
|
10
|
+
type: _0__file_id_js_1.FileType.Photo,
|
|
11
|
+
dcId: file.dc_id,
|
|
12
|
+
fileReference: file.file_reference,
|
|
13
|
+
location: { type: "photo", id: file.id, accessHash: file.access_hash, source: { type: _0__file_id_js_1.PhotoSourceType.Thumbnail, fileType, thumbnailType: size.type.charCodeAt(0) } },
|
|
14
|
+
}
|
|
15
|
+
: {
|
|
16
|
+
type: _0__file_id_js_1.FileType.Photo,
|
|
17
|
+
dcId: file.dc_id,
|
|
18
|
+
fileReference: file.file_reference,
|
|
19
|
+
location: { type: "common", id: file.id, accessHash: file.access_hash },
|
|
20
|
+
};
|
|
19
21
|
return {
|
|
20
|
-
fileId,
|
|
21
|
-
fileUniqueId,
|
|
22
|
+
fileId: (0, _0__file_id_js_1.serializeFileId)(fileId_),
|
|
23
|
+
fileUniqueId: (0, _0__file_id_js_1.toUniqueFileId)(fileId_),
|
|
22
24
|
width: size.w,
|
|
23
25
|
height: size.h,
|
|
24
26
|
fileSize: size.size,
|
|
@@ -3,7 +3,9 @@ import { GiveawayParameters } from "./0_giveaway_parameters.js";
|
|
|
3
3
|
/** A giveaway. */
|
|
4
4
|
export interface Giveaway {
|
|
5
5
|
parameters: GiveawayParameters;
|
|
6
|
+
/** The quantity of the Telegram Premium subscriptions that will be given away.. */
|
|
6
7
|
winnerCount: number;
|
|
8
|
+
/** The duration of each Telegram Premium subscription that is to be given away in months. */
|
|
7
9
|
monthCount: number;
|
|
8
10
|
}
|
|
9
11
|
export declare function constructGiveaway(g: types.MessageMediaGiveaway): Giveaway;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { MiniAppInfo } from "./0_mini_app_info.js";
|
|
2
2
|
/** A button to be shown along with the results of an inline query. */
|
|
3
3
|
export interface InlineQueryResultButton {
|
|
4
|
+
/** Label text on the button. */
|
|
4
5
|
text: string;
|
|
6
|
+
/** Description of the Mini App that will be launched when the user presses the button. */
|
|
5
7
|
miniApp?: MiniAppInfo;
|
|
8
|
+
/** Deep linking parameter for the /start message. */
|
|
6
9
|
startParameter?: string;
|
|
7
10
|
}
|
package/script/types/1_photo.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.constructPhoto = void 0;
|
|
4
4
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
5
5
|
const _0__file_id_js_1 = require("./0__file_id.js");
|
|
6
|
+
const _0__file_id_js_2 = require("./0__file_id.js");
|
|
6
7
|
const _0_thumbnail_js_1 = require("./0_thumbnail.js");
|
|
7
8
|
function constructPhoto(photo) {
|
|
8
9
|
const sizes = photo.sizes
|
|
@@ -17,20 +18,25 @@ function constructPhoto(photo) {
|
|
|
17
18
|
.filter((v) => v instanceof _2_tl_js_1.types.PhotoSize)
|
|
18
19
|
.sort((a, b) => a.size - b.size);
|
|
19
20
|
const largest = sizes.slice(-1)[0];
|
|
20
|
-
const { dc_id: dcId, id
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const { dc_id: dcId, id, access_hash: accessHash, file_reference: fileReference } = photo;
|
|
22
|
+
const fileId_ = {
|
|
23
|
+
type: _0__file_id_js_2.FileType.Photo,
|
|
24
|
+
dcId,
|
|
25
|
+
fileReference,
|
|
26
|
+
location: {
|
|
27
|
+
type: "photo",
|
|
28
|
+
id,
|
|
25
29
|
accessHash,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
source: {
|
|
31
|
+
type: _0__file_id_js_1.PhotoSourceType.Thumbnail,
|
|
32
|
+
fileType: _0__file_id_js_2.FileType.Photo,
|
|
33
|
+
thumbnailType: largest.type.charCodeAt(0),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
fileId: (0, _0__file_id_js_2.serializeFileId)(fileId_),
|
|
39
|
+
fileUniqueId: (0, _0__file_id_js_2.toUniqueFileId)(fileId_),
|
|
34
40
|
width: largest.w,
|
|
35
41
|
height: largest.h,
|
|
36
42
|
fileSize: largest.size,
|
package/script/types/1_poll.d.ts
CHANGED
|
@@ -3,18 +3,31 @@ import { MessageEntity } from "./0_message_entity.js";
|
|
|
3
3
|
import { PollOption } from "./0_poll_option.js";
|
|
4
4
|
/** A poll. */
|
|
5
5
|
export interface Poll {
|
|
6
|
+
/** The identifier of the poll. */
|
|
6
7
|
id: string;
|
|
8
|
+
/** The poll's question. */
|
|
7
9
|
question: string;
|
|
10
|
+
/** The poll's options. */
|
|
8
11
|
options: PollOption[];
|
|
12
|
+
/** The number of users who have participated in the poll. */
|
|
9
13
|
totalVoterCount: number;
|
|
14
|
+
/** Whether the poll is closed. */
|
|
10
15
|
isClosed: boolean;
|
|
16
|
+
/** Whether the poll is anonymous. */
|
|
11
17
|
isAnonymous: boolean;
|
|
18
|
+
/** The type of the poll. */
|
|
12
19
|
type: "regular" | "quiz";
|
|
20
|
+
/** Whether the poll allows multiple answers. */
|
|
13
21
|
allowMultipleAnswers?: boolean;
|
|
22
|
+
/** Index of the correct option. */
|
|
14
23
|
correctOptionIndex?: number;
|
|
24
|
+
/** A text that is shown to the user when the poll is answered. */
|
|
15
25
|
explanation?: string;
|
|
26
|
+
/** The explanation's entities. */
|
|
16
27
|
explanationEntities?: MessageEntity[];
|
|
28
|
+
/** Duration of the poll in seconds. */
|
|
17
29
|
openPeriod?: number;
|
|
30
|
+
/** The time in which the poll will be closed. */
|
|
18
31
|
closeDate?: Date;
|
|
19
32
|
}
|
|
20
33
|
export declare function constructPoll(media_: types.MessageMediaPoll): Poll;
|
|
@@ -2,7 +2,9 @@ import { types } from "../2_tl.js";
|
|
|
2
2
|
import { Reaction } from "./0_reaction.js";
|
|
3
3
|
/** The count of a specific reaction. */
|
|
4
4
|
export interface ReactionCount {
|
|
5
|
+
/** The type of the reaction. */
|
|
5
6
|
reaction: Reaction;
|
|
7
|
+
/** Number of times the reaction was added. */
|
|
6
8
|
count: number;
|
|
7
9
|
}
|
|
8
10
|
export declare function constructReactionCount(reaction_: types.ReactionCount): ReactionCount;
|
|
@@ -2,8 +2,11 @@ import { enums } from "../2_tl.js";
|
|
|
2
2
|
import { MessageEntity } from "./0_message_entity.js";
|
|
3
3
|
/** A reference to a specific part of a message that is being replied to. */
|
|
4
4
|
export interface ReplyQuote {
|
|
5
|
+
/** The byte offset of the quoted text. */
|
|
5
6
|
offset: number;
|
|
7
|
+
/** The quoted text. */
|
|
6
8
|
text: string;
|
|
9
|
+
/** The entities of the quoted text. */
|
|
7
10
|
entities: MessageEntity[];
|
|
8
11
|
}
|
|
9
12
|
export declare function constructReplyQuote(quoteText: string | undefined, quoteOffset: number | undefined, quoteEntities: enums.MessageEntity[] | undefined): ReplyQuote;
|
package/script/types/1_user.d.ts
CHANGED
|
@@ -6,31 +6,31 @@ export interface User {
|
|
|
6
6
|
id: number;
|
|
7
7
|
/** Identifier of color that can be displayed instead of the user's photo. */
|
|
8
8
|
color: number;
|
|
9
|
-
/**
|
|
9
|
+
/** Whether the user is a bot. */
|
|
10
10
|
isBot: boolean;
|
|
11
|
-
/**
|
|
11
|
+
/** The first name of the user. */
|
|
12
12
|
firstName: string;
|
|
13
|
-
/**
|
|
13
|
+
/** The last name of the user. */
|
|
14
14
|
lastName?: string;
|
|
15
|
-
/**
|
|
15
|
+
/** The user’s main username. */
|
|
16
16
|
username?: string;
|
|
17
|
-
/**
|
|
17
|
+
/** The user's additional usernames. */
|
|
18
18
|
also?: string[];
|
|
19
|
-
/** The user's photo. */
|
|
19
|
+
/** The user's profile photo. */
|
|
20
20
|
photo?: ChatPhotoUser;
|
|
21
|
-
/** [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag)
|
|
21
|
+
/** The user's [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag). */
|
|
22
22
|
languageCode?: string;
|
|
23
|
-
/**
|
|
23
|
+
/** Whether the user has been identified as scam. */
|
|
24
24
|
isScam: boolean;
|
|
25
|
-
/**
|
|
25
|
+
/** Whether the user has been identified as an impersonator. */
|
|
26
26
|
isFake: boolean;
|
|
27
|
-
/**
|
|
27
|
+
/** Whether the user is subscribed to Telegram Premium. */
|
|
28
28
|
isPremium: boolean;
|
|
29
|
-
/**
|
|
29
|
+
/** Whether the user has been verified. */
|
|
30
30
|
isVerified: boolean;
|
|
31
|
-
/**
|
|
31
|
+
/** Whether the user is official support. */
|
|
32
32
|
isSupport: boolean;
|
|
33
|
-
/**
|
|
33
|
+
/** Whether the user is a bot that has been added to the attachment menu by the current user. */
|
|
34
34
|
addedToAttachmentMenu: boolean;
|
|
35
35
|
}
|
|
36
36
|
export declare function constructUser(user_: types.User): User;
|
|
@@ -4,10 +4,15 @@ import { EntityGetter } from "./1__getters.js";
|
|
|
4
4
|
import { User } from "./1_user.js";
|
|
5
5
|
/** A chosen inline result. */
|
|
6
6
|
export interface ChosenInlineResult {
|
|
7
|
+
/** The identifier of the inline result that was chosen. */
|
|
7
8
|
resultId: string;
|
|
9
|
+
/** The user who chose the result. */
|
|
8
10
|
from: User;
|
|
11
|
+
/** The location of the user who chose the result. */
|
|
9
12
|
location?: Location;
|
|
13
|
+
/** Identifier of the sent inline message. */
|
|
10
14
|
inlineMessageId?: string;
|
|
15
|
+
/** The query that was used to obtain the result. */
|
|
11
16
|
query: string;
|
|
12
17
|
}
|
|
13
18
|
export declare function constructChosenInlineResult(ubis: types.UpdateBotInlineSend, getEntity: EntityGetter): Promise<ChosenInlineResult>;
|
package/script/types/2_game.d.ts
CHANGED
|
@@ -4,11 +4,17 @@ import { Animation } from "./1_animation.js";
|
|
|
4
4
|
import { Photo } from "./1_photo.js";
|
|
5
5
|
/** A game. */
|
|
6
6
|
export interface Game {
|
|
7
|
+
/** The title of the game. */
|
|
7
8
|
title: string;
|
|
9
|
+
/** The description of the game. */
|
|
8
10
|
description: string;
|
|
11
|
+
/** A photo that is displayed when the game is shared. */
|
|
9
12
|
photo: Photo;
|
|
13
|
+
/** A text that is displayed when the game is shared. */
|
|
10
14
|
text?: string;
|
|
15
|
+
/** The text's entities. */
|
|
11
16
|
textEntities?: MessageEntity[];
|
|
17
|
+
/** An animation that is displayed when the game is shared. */
|
|
12
18
|
animation?: Animation;
|
|
13
19
|
}
|
|
14
20
|
export declare function constructGame(media_: types.MessageMediaGame): Game;
|
package/script/types/2_game.js
CHANGED
|
@@ -9,16 +9,20 @@ const _1_photo_js_1 = require("./1_photo.js");
|
|
|
9
9
|
function constructGame(media_) {
|
|
10
10
|
const game_ = media_.game;
|
|
11
11
|
const document_ = game_.document ? game_.document[_2_tl_js_1.as](_2_tl_js_1.types.Document) : undefined;
|
|
12
|
+
const fileId_ = document_
|
|
13
|
+
? {
|
|
14
|
+
type: _0__file_id_js_1.FileType.Animation,
|
|
15
|
+
dcId: document_.dc_id,
|
|
16
|
+
fileReference: document_.file_reference,
|
|
17
|
+
location: { type: "common", id: document_.id, accessHash: document_.access_hash },
|
|
18
|
+
}
|
|
19
|
+
: undefined;
|
|
12
20
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
13
21
|
title: game_.title,
|
|
14
22
|
description: media_.game.description,
|
|
15
23
|
photo: (0, _1_photo_js_1.constructPhoto)(game_.photo[_2_tl_js_1.as](_2_tl_js_1.types.Photo)),
|
|
16
|
-
animation: document_
|
|
17
|
-
? (0, _1_animation_js_1.constructAnimation)(document_, document_.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeVideo), document_.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeFilename),
|
|
18
|
-
mediaId: document_.id,
|
|
19
|
-
accessHash: document_.access_hash,
|
|
20
|
-
fileReference: document_.file_reference,
|
|
21
|
-
}).encode(), new _0__file_id_js_1.FileUniqueID(_0__file_id_js_1.FileUniqueType.Document, { mediaId: document_.id }).encode())
|
|
24
|
+
animation: fileId_ && document_
|
|
25
|
+
? (0, _1_animation_js_1.constructAnimation)(document_, document_.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeVideo), document_.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeFilename), (0, _0__file_id_js_1.serializeFileId)(fileId_), (0, _0__file_id_js_1.toUniqueFileId)(fileId_))
|
|
22
26
|
: undefined,
|
|
23
27
|
});
|
|
24
28
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { enums } from "../2_tl.js";
|
|
2
2
|
import { ChatP } from "./1_chat_p.js";
|
|
3
|
+
/** An inactive chat. */
|
|
3
4
|
export interface InactiveChat {
|
|
5
|
+
/** The point of time in which the chat was last active. */
|
|
4
6
|
lastActivity: Date;
|
|
7
|
+
/** The chat that has been marked as inactive. */
|
|
5
8
|
chat: ChatP;
|
|
6
9
|
}
|
|
7
10
|
export declare function constructInactiveChat(chat_: enums.Chat, lastActivity: number): InactiveChat;
|
|
@@ -4,11 +4,17 @@ import { EntityGetter } from "./1__getters.js";
|
|
|
4
4
|
import { User } from "./1_user.js";
|
|
5
5
|
/** An incoming inline query. */
|
|
6
6
|
export interface InlineQuery {
|
|
7
|
+
/** The identifier of the inline query. */
|
|
7
8
|
id: string;
|
|
9
|
+
/** The user who made the inline query. */
|
|
8
10
|
from: User;
|
|
11
|
+
/** The query that was made. */
|
|
9
12
|
query: string;
|
|
13
|
+
/** The offset parameter that was passed to the last [answerInlineQuery](/methods/answerInlineQuery) call. */
|
|
10
14
|
offset: string;
|
|
15
|
+
/** The type of the chat from which the inline query was made. */
|
|
11
16
|
chatType?: "sender" | "private" | "group" | "supergroup" | "channel";
|
|
17
|
+
/** The location of the user who made the inline query. */
|
|
12
18
|
location?: Location;
|
|
13
19
|
}
|
|
14
20
|
export declare function constructInlineQuery(query_: types.UpdateBotInlineQuery, getEntity: EntityGetter): Promise<InlineQuery>;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { MessageReaction } from "./1_message_reaction.js";
|
|
2
2
|
/** The interactions made with a message. */
|
|
3
3
|
export interface MessageInteractions {
|
|
4
|
+
/** The identifier of the message's chat. */
|
|
4
5
|
chatId: number;
|
|
6
|
+
/** The message's identifier. */
|
|
5
7
|
messageId: number;
|
|
8
|
+
/** The reactions made to the message. */
|
|
6
9
|
reactions: MessageReaction[];
|
|
10
|
+
/** The number of times the message was viewed. */
|
|
7
11
|
views: number;
|
|
12
|
+
/** The number of times the message was forwarded. */
|
|
8
13
|
forwards: number;
|
|
9
14
|
}
|
|
@@ -4,9 +4,13 @@ import { ChatP } from "./1_chat_p.js";
|
|
|
4
4
|
import { ReactionCount } from "./1_reaction_count.js";
|
|
5
5
|
/** Information on the reactions made to a channel post. */
|
|
6
6
|
export interface MessageReactionCount {
|
|
7
|
+
/** The chat containing the message. */
|
|
7
8
|
chat: ChatP;
|
|
9
|
+
/** The message's identifier. */
|
|
8
10
|
messageId: number;
|
|
11
|
+
/** This reaction state's point of time. */
|
|
9
12
|
date: Date;
|
|
13
|
+
/** The reactions made to the post. */
|
|
10
14
|
reactions: ReactionCount[];
|
|
11
15
|
}
|
|
12
16
|
export declare function constructMessageReactionCount(update: types.UpdateBotMessageReactions, getEntity: EntityGetter): Promise<MessageReactionCount | null>;
|
|
@@ -5,12 +5,19 @@ import { ChatP } from "./1_chat_p.js";
|
|
|
5
5
|
import { User } from "./1_user.js";
|
|
6
6
|
/** The reactions of a user to a messages in a group. */
|
|
7
7
|
export interface MessageReactions {
|
|
8
|
+
/** The chat containing the message the user reacted to. */
|
|
8
9
|
chat: ChatP;
|
|
10
|
+
/** The message's identifier. */
|
|
9
11
|
messageId: number;
|
|
12
|
+
/** The user who changed their reactions to the message. Unset if done on behalf of a chat. */
|
|
10
13
|
user?: User;
|
|
14
|
+
/** The chat that changed its reactions to the message. Unset if done on behalf of a user. */
|
|
11
15
|
actorChat?: ChatP;
|
|
16
|
+
/** The point of time in which the change was made. */
|
|
12
17
|
date: Date;
|
|
18
|
+
/** The previous reactions. */
|
|
13
19
|
oldReactions: Reaction[];
|
|
20
|
+
/** The current reactions. */
|
|
14
21
|
newReactions: Reaction[];
|
|
15
22
|
}
|
|
16
23
|
export declare function constructMessageReactions(update: types.UpdateBotMessageReaction, getEntity: EntityGetter): Promise<MessageReactions | null>;
|
|
@@ -23,12 +23,9 @@ function constructStoryContent(media) {
|
|
|
23
23
|
if (!video) {
|
|
24
24
|
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
accessHash: document.access_hash,
|
|
30
|
-
fileReference: document.file_reference,
|
|
31
|
-
}).encode();
|
|
26
|
+
const fileId_ = { type: _0__file_id_js_1.FileType.Video, dcId: document.dc_id, fileReference: document.file_reference, location: { type: "common", id: document.id, accessHash: document.access_hash } };
|
|
27
|
+
const fileUniqueId = (0, _0__file_id_js_1.toUniqueFileId)(fileId_);
|
|
28
|
+
const fileId = (0, _0__file_id_js_1.serializeFileId)(fileId_);
|
|
32
29
|
const video_ = (0, _1_video_js_1.constructVideo)(document, video, undefined, fileId, fileUniqueId);
|
|
33
30
|
return { video: video_ };
|
|
34
31
|
}
|
|
@@ -178,16 +178,16 @@ async function inlineQueryResultToTlObject(result_, parseText, usernameResolver)
|
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
else if (fileId_ != null) {
|
|
181
|
-
const fileId = _0__file_id_js_1.
|
|
181
|
+
const fileId = (0, _0__file_id_js_1.deserializeFileId)(fileId_);
|
|
182
182
|
return new _2_tl_js_1.types.InputBotInlineResultDocument({
|
|
183
183
|
id,
|
|
184
184
|
type: type == "document" ? "file" : type,
|
|
185
185
|
title,
|
|
186
186
|
description,
|
|
187
187
|
document: new _2_tl_js_1.types.InputDocument({
|
|
188
|
-
id: fileId.
|
|
189
|
-
access_hash: fileId.
|
|
190
|
-
file_reference: fileId.
|
|
188
|
+
id: "id" in fileId.location ? fileId.location.id : (0, _1_utilities_js_1.UNREACHABLE)(),
|
|
189
|
+
access_hash: fileId.location.accessHash,
|
|
190
|
+
file_reference: fileId.fileReference ?? new Uint8Array(),
|
|
191
191
|
}),
|
|
192
192
|
send_message: sendMessage,
|
|
193
193
|
});
|
|
@@ -4,6 +4,7 @@ exports.constructMessage = exports.assertMessageType = void 0;
|
|
|
4
4
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
5
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
6
|
const _0__file_id_js_1 = require("./0__file_id.js");
|
|
7
|
+
const _0__file_id_js_2 = require("./0__file_id.js");
|
|
7
8
|
const _0_contact_js_1 = require("./0_contact.js");
|
|
8
9
|
const _0_dice_js_1 = require("./0_dice.js");
|
|
9
10
|
const _0_link_preview_js_1 = require("./0_link_preview.js");
|
|
@@ -122,9 +123,10 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
|
|
|
122
123
|
isTopicMessage: false,
|
|
123
124
|
};
|
|
124
125
|
Object.assign(message, await getSender(message_, getEntity));
|
|
125
|
-
if (message_.action instanceof _2_tl_js_1.types.MessageActionChatAddUser) {
|
|
126
|
+
if (message_.action instanceof _2_tl_js_1.types.MessageActionChatAddUser || message_.action instanceof _2_tl_js_1.types.MessageActionChatJoinedByLink || message_.action instanceof _2_tl_js_1.types.MessageActionChatJoinedByRequest) {
|
|
126
127
|
const newChatMembers = new Array();
|
|
127
|
-
|
|
128
|
+
const users = "users" in message_.action ? message_.action.users : [message_.from_id && "user_id" in message_.from_id ? message_.from_id.user_id : (0, _1_utilities_js_1.UNREACHABLE)()];
|
|
129
|
+
for (const user_ of users) {
|
|
128
130
|
const entity = await getEntity(new _2_tl_js_1.types.PeerUser({ user_id: user_ }));
|
|
129
131
|
if (entity) {
|
|
130
132
|
const user = (0, _1_user_js_1.constructUser)(entity);
|
|
@@ -393,51 +395,54 @@ async function constructMessage(message_, getEntity, getMessage, getStickerSetNa
|
|
|
393
395
|
else if (message_.media instanceof _2_tl_js_1.types.MessageMediaDocument) {
|
|
394
396
|
const { document } = message_.media;
|
|
395
397
|
if (document instanceof _2_tl_js_1.types.Document) {
|
|
396
|
-
const getFileId = (type) =>
|
|
397
|
-
|
|
398
|
-
|
|
398
|
+
const getFileId = (type) => ({
|
|
399
|
+
type,
|
|
400
|
+
dcId: document.dc_id,
|
|
399
401
|
fileReference: document.file_reference,
|
|
400
|
-
|
|
401
|
-
|
|
402
|
+
location: { type: "common", id: document.id, accessHash: document.access_hash },
|
|
403
|
+
});
|
|
402
404
|
const animated = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeAnimated);
|
|
403
405
|
const audio = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeAudio);
|
|
404
406
|
const fileName = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeFilename);
|
|
405
407
|
const sticker = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeSticker);
|
|
406
408
|
const video = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeVideo);
|
|
407
409
|
if (animated) {
|
|
408
|
-
const
|
|
410
|
+
const fileId = getFileId(_0__file_id_js_1.FileType.Animation);
|
|
411
|
+
const animation = (0, _1_animation_js_1.constructAnimation)(document, video, fileName, (0, _0__file_id_js_2.serializeFileId)(fileId), (0, _0__file_id_js_1.toUniqueFileId)(fileId));
|
|
409
412
|
m = { ...messageMedia, animation };
|
|
410
413
|
}
|
|
411
414
|
else if (video) {
|
|
412
415
|
if (video.round_message) {
|
|
413
|
-
const
|
|
416
|
+
const fileId = getFileId(_0__file_id_js_1.FileType.VideoNote);
|
|
417
|
+
const videoNote = (0, _1_video_note_js_1.constructVideoNote)(document, video, (0, _0__file_id_js_2.serializeFileId)(fileId), (0, _0__file_id_js_1.toUniqueFileId)(fileId));
|
|
414
418
|
m = { ...message, videoNote };
|
|
415
419
|
}
|
|
416
420
|
else {
|
|
417
|
-
const
|
|
421
|
+
const fileId = getFileId(_0__file_id_js_1.FileType.Video);
|
|
422
|
+
const video_ = (0, _1_video_js_1.constructVideo)(document, video, fileName?.file_name, (0, _0__file_id_js_2.serializeFileId)(fileId), (0, _0__file_id_js_1.toUniqueFileId)(fileId));
|
|
418
423
|
m = { ...messageMedia, video: video_ };
|
|
419
424
|
}
|
|
420
425
|
}
|
|
421
426
|
else if (audio) {
|
|
422
427
|
if (audio.voice) {
|
|
423
|
-
const
|
|
428
|
+
const fileId = getFileId(_0__file_id_js_1.FileType.VoiceNote);
|
|
429
|
+
const voice = (0, _0_voice_js_1.constructVoice)(document, audio, (0, _0__file_id_js_2.serializeFileId)(fileId), (0, _0__file_id_js_1.toUniqueFileId)(fileId));
|
|
424
430
|
m = { ...messageMedia, voice };
|
|
425
431
|
}
|
|
426
432
|
else {
|
|
427
|
-
const
|
|
433
|
+
const fileId = getFileId(_0__file_id_js_1.FileType.Audio);
|
|
434
|
+
const audio_ = (0, _1_audio_js_1.constructAudio)(document, audio, (0, _0__file_id_js_2.serializeFileId)(fileId), (0, _0__file_id_js_1.toUniqueFileId)(fileId));
|
|
428
435
|
m = { ...messageMedia, audio: audio_ };
|
|
429
436
|
}
|
|
430
437
|
}
|
|
431
438
|
else if (sticker) {
|
|
432
|
-
const
|
|
439
|
+
const fileId = getFileId(_0__file_id_js_1.FileType.Sticker);
|
|
440
|
+
const sticker = await (0, _1_sticker_js_1.constructSticker)(document, (0, _0__file_id_js_2.serializeFileId)(fileId), (0, _0__file_id_js_1.toUniqueFileId)(fileId), getStickerSetName);
|
|
433
441
|
m = { ...message, sticker };
|
|
434
442
|
}
|
|
435
|
-
else if (fileName) {
|
|
436
|
-
const document_ = (0, _1_document_js_1.constructDocument)(document, fileName, getFileId(_0__file_id_js_1.FileType.Document), fileUniqueId);
|
|
437
|
-
m = { ...messageMedia, document: document_ };
|
|
438
|
-
}
|
|
439
443
|
else {
|
|
440
|
-
const
|
|
444
|
+
const fileId = getFileId(_0__file_id_js_1.FileType.Document);
|
|
445
|
+
const document_ = (0, _1_document_js_1.constructDocument)(document, fileName ?? new _2_tl_js_1.types.DocumentAttributeFilename({ file_name: "Unknown" }), (0, _0__file_id_js_2.serializeFileId)(fileId), (0, _0__file_id_js_1.toUniqueFileId)(fileId));
|
|
441
446
|
m = { ...messageMedia, document: document_ };
|
|
442
447
|
}
|
|
443
448
|
}
|
|
@@ -4,12 +4,19 @@ import { User } from "./1_user.js";
|
|
|
4
4
|
import { Message, MessageGetter } from "./4_message.js";
|
|
5
5
|
/** A received callback query. */
|
|
6
6
|
export interface CallbackQuery {
|
|
7
|
+
/** The identifier of the callback query. */
|
|
7
8
|
id: string;
|
|
9
|
+
/** The user who made the callback query. */
|
|
8
10
|
from: User;
|
|
11
|
+
/** The message from which the callback query was made. Unset if made from an inline result message. */
|
|
9
12
|
message?: Message;
|
|
13
|
+
/** The identifier of the inline result message from which the callback query was made. Unset if made from a message not originating from an inline query result. */
|
|
10
14
|
inlineMessageId?: string;
|
|
15
|
+
/** A special identifier for the chat in which the callback was made from. Useful for inline result messages. */
|
|
11
16
|
chatInstance: string;
|
|
17
|
+
/** The data associated with the button that was used to make the callback query. */
|
|
12
18
|
data?: string;
|
|
19
|
+
/** The short name of the game to be returned. */
|
|
13
20
|
gameShortName?: string;
|
|
14
21
|
}
|
|
15
22
|
export declare function deserializeInlineMessageId(inlineMessageId: string): enums.InputBotInlineMessageID;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function concat(...buffers: [Uint8Array, Uint8Array, ...Uint8Array[]]): Uint8Array;
|
|
2
|
-
export declare function bufferFromBigInt(
|
|
2
|
+
export declare function bufferFromBigInt(int: bigint | number, byteCount: number, littleEndian?: boolean, signed?: boolean): Uint8Array;
|
|
@@ -16,31 +16,33 @@ function concat(...buffers) {
|
|
|
16
16
|
}
|
|
17
17
|
exports.concat = concat;
|
|
18
18
|
const bufferFromHexString = (hexString) => Uint8Array.from(hexString.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)));
|
|
19
|
-
function bufferFromBigInt(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
function bufferFromBigInt(int, byteCount, littleEndian = true, signed = false) {
|
|
20
|
+
const actualByteCount = Math.ceil(int.toString(2).length / 8);
|
|
21
|
+
if (byteCount < actualByteCount) {
|
|
22
|
+
throw new Error("Int too big");
|
|
23
|
+
}
|
|
24
|
+
if (byteCount == 4 || byteCount == 2) { // fast path
|
|
25
|
+
const buffer = new Uint8Array(byteCount);
|
|
26
|
+
const dataView = new DataView(buffer.buffer);
|
|
27
|
+
(byteCount == 2 ? signed ? dataView.setInt16 : dataView.setUint16 : signed ? dataView.setInt32 : dataView.setUint32).call(dataView, 0, Number(int), littleEndian);
|
|
28
|
+
return buffer;
|
|
29
|
+
}
|
|
30
|
+
int = BigInt(typeof int === "number" ? Math.ceil(int) : int);
|
|
31
|
+
if (byteCount == 8) { // fast path
|
|
32
|
+
const buffer = new Uint8Array(byteCount);
|
|
33
|
+
const dataView = new DataView(buffer.buffer);
|
|
34
|
+
(signed ? dataView.setBigInt64 : dataView.setBigUint64).call(dataView, 0, int, littleEndian);
|
|
35
|
+
return buffer;
|
|
36
|
+
}
|
|
37
|
+
if (!signed && int < 0n) {
|
|
38
|
+
throw new Error("Got unexpected signed int");
|
|
39
|
+
}
|
|
40
|
+
if (signed && int < 0n) {
|
|
41
|
+
int = 2n ** BigInt(byteCount * 8) + int;
|
|
42
|
+
}
|
|
43
|
+
const hex = int.toString(16).padStart(byteCount * 2, "0");
|
|
35
44
|
const buffer = bufferFromHexString(hex);
|
|
36
|
-
if (
|
|
37
|
-
buffer[buffer.length - 1] = 256 -
|
|
38
|
-
buffer[buffer.length - 1];
|
|
39
|
-
for (let i = 0; i < buffer.length - 1; i++) {
|
|
40
|
-
buffer[i] = 255 - buffer[i];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (little) {
|
|
45
|
+
if (littleEndian) {
|
|
44
46
|
buffer.reverse();
|
|
45
47
|
}
|
|
46
48
|
return buffer;
|