@mtkruto/node 0.1.145 → 0.1.146
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/3_types.d.ts +2 -0
- package/esm/3_types.js +2 -0
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/client/1_reaction_manager.d.ts +4 -2
- package/esm/client/2_message_manager.d.ts +3 -2
- package/esm/client/2_message_manager.js +19 -2
- package/esm/client/3_callback_query_manager.d.ts +3 -2
- package/esm/client/3_chat_list_manager.d.ts +3 -2
- package/esm/client/3_inline_query_manager.d.ts +3 -2
- package/esm/types/2_invite_link.d.ts +23 -0
- package/esm/types/2_invite_link.js +27 -0
- package/esm/types/3_chat_member_updated.d.ts +23 -0
- package/esm/types/3_chat_member_updated.js +33 -0
- package/esm/types/4_message.d.ts +7 -7
- package/esm/types/6_update.d.ts +19 -2
- package/package.json +1 -1
- package/script/3_types.d.ts +2 -0
- package/script/3_types.js +2 -0
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/client/1_reaction_manager.d.ts +4 -2
- package/script/client/2_message_manager.d.ts +3 -2
- package/script/client/2_message_manager.js +51 -34
- package/script/client/3_callback_query_manager.d.ts +3 -2
- package/script/client/3_chat_list_manager.d.ts +3 -2
- package/script/client/3_inline_query_manager.d.ts +3 -2
- package/script/types/2_invite_link.d.ts +23 -0
- package/script/types/2_invite_link.js +31 -0
- package/script/types/3_chat_member_updated.d.ts +23 -0
- package/script/types/3_chat_member_updated.js +37 -0
- package/script/types/4_message.d.ts +7 -7
- package/script/types/6_update.d.ts +19 -2
package/esm/3_types.d.ts
CHANGED
|
@@ -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
|
@@ -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/4_constants.d.ts
CHANGED
|
@@ -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.
|
|
7
|
+
export declare const APP_VERSION = "MTKruto 0.1.146";
|
|
8
8
|
export declare const DEVICE_MODEL: string;
|
|
9
9
|
export declare const LANG_CODE: string;
|
|
10
10
|
export declare const LANG_PACK = "";
|
package/esm/4_constants.js
CHANGED
|
@@ -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.
|
|
56
|
+
export const APP_VERSION = "MTKruto 0.1.146";
|
|
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
|
|
8
|
-
handleUpdate(update:
|
|
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
|
|
50
|
-
handleUpdate(update:
|
|
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 ||
|
|
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
|
|
14
|
-
handleUpdate(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
|
|
14
|
-
handleUpdate(update:
|
|
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
|
|
14
|
-
handleUpdate(update:
|
|
14
|
+
static canHandleUpdate(update: enums.Update): update is InlineQueryManagerUpdate;
|
|
15
|
+
handleUpdate(update: InlineQueryManagerUpdate): Promise<Update>;
|
|
15
16
|
}
|
|
16
17
|
export {};
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
package/esm/types/4_message.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export interface _MessageBase {
|
|
|
88
88
|
* Properties shared between media message types.
|
|
89
89
|
* @unlisted
|
|
90
90
|
*/
|
|
91
|
-
export interface
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
155
|
+
export interface MessageAudio extends _MessageMediaBase {
|
|
156
156
|
/** The audio included in the message. */
|
|
157
157
|
audio: Audio;
|
|
158
158
|
}
|
package/esm/types/6_update.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { InlineQuery } from "./2_inline_query.js";
|
|
|
6
6
|
import { MessageInteractions } from "./2_message_interactions.js";
|
|
7
7
|
import { MessageReactionCount } from "./2_message_reaction_count.js";
|
|
8
8
|
import { MessageReactions } from "./2_message_reactions.js";
|
|
9
|
+
import { ChatMemberUpdated } from "./3_chat_member_updated.js";
|
|
9
10
|
import { Message } from "./4_message.js";
|
|
10
11
|
import { CallbackQuery } from "./5_callback_query.js";
|
|
11
12
|
import { Chat } from "./5_chat.js";
|
|
@@ -183,6 +184,20 @@ export interface UpdateMessageReactionCount {
|
|
|
183
184
|
export interface UpdateMessageReactions {
|
|
184
185
|
messageReactions: MessageReactions;
|
|
185
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* The status of a chat member was changed.
|
|
189
|
+
* @unlisted
|
|
190
|
+
*/
|
|
191
|
+
export interface UpdateChatMember {
|
|
192
|
+
chatMember: ChatMemberUpdated;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The status of a current account was changed in a chat.
|
|
196
|
+
* @unlisted
|
|
197
|
+
*/
|
|
198
|
+
export interface UpdateMyChatMember {
|
|
199
|
+
myChatMember: ChatMemberUpdated;
|
|
200
|
+
}
|
|
186
201
|
/** @unlisted */
|
|
187
202
|
export interface UpdateMap {
|
|
188
203
|
message: UpdateNewMessage;
|
|
@@ -199,8 +214,10 @@ export interface UpdateMap {
|
|
|
199
214
|
messageInteractions: UpdateMessageInteractions;
|
|
200
215
|
messageReactionCount: UpdateMessageReactionCount;
|
|
201
216
|
messageReactions: UpdateMessageReactions;
|
|
217
|
+
chatMember: UpdateChatMember;
|
|
218
|
+
myChatMember: UpdateMyChatMember;
|
|
202
219
|
}
|
|
203
220
|
/** @unlisted */
|
|
204
|
-
export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions>;
|
|
221
|
+
export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember>;
|
|
205
222
|
/** An incoming update. */
|
|
206
|
-
export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions;
|
|
223
|
+
export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember;
|
package/package.json
CHANGED
package/script/3_types.d.ts
CHANGED
|
@@ -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/script/3_types.js
CHANGED
|
@@ -68,9 +68,11 @@ __exportStar(require("./types/2_chosen_inline_result.js"), exports);
|
|
|
68
68
|
__exportStar(require("./types/2_game.js"), exports);
|
|
69
69
|
__exportStar(require("./types/2_inline_keyboard_button.js"), exports);
|
|
70
70
|
__exportStar(require("./types/2_inline_query.js"), exports);
|
|
71
|
+
__exportStar(require("./types/2_invite_link.js"), exports);
|
|
71
72
|
__exportStar(require("./types/2_message_interactions.js"), exports);
|
|
72
73
|
__exportStar(require("./types/2_message_reaction_count.js"), exports);
|
|
73
74
|
__exportStar(require("./types/2_message_reactions.js"), exports);
|
|
75
|
+
__exportStar(require("./types/3_chat_member_updated.js"), exports);
|
|
74
76
|
__exportStar(require("./types/3_reply_markup.js"), exports);
|
|
75
77
|
__exportStar(require("./types/4_inline_query_result.js"), exports);
|
|
76
78
|
__exportStar(require("./types/4_message.js"), exports);
|
package/script/4_constants.d.ts
CHANGED
|
@@ -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.
|
|
7
|
+
export declare const APP_VERSION = "MTKruto 0.1.146";
|
|
8
8
|
export declare const DEVICE_MODEL: string;
|
|
9
9
|
export declare const LANG_CODE: string;
|
|
10
10
|
export declare const LANG_PACK = "";
|
package/script/4_constants.js
CHANGED
|
@@ -79,7 +79,7 @@ exports.PUBLIC_KEYS = Object.freeze([
|
|
|
79
79
|
]);
|
|
80
80
|
exports.INITIAL_DC = "2";
|
|
81
81
|
exports.LAYER = 172;
|
|
82
|
-
exports.APP_VERSION = "MTKruto 0.1.
|
|
82
|
+
exports.APP_VERSION = "MTKruto 0.1.146";
|
|
83
83
|
// @ts-ignore: lib
|
|
84
84
|
exports.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;
|
|
85
85
|
exports.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
|
|
8
|
-
handleUpdate(update:
|
|
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
|
|
50
|
-
handleUpdate(update:
|
|
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>;
|
|
@@ -17,6 +17,7 @@ const _0_deps_js_1 = require("../0_deps.js");
|
|
|
17
17
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
18
18
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
19
19
|
const _3_types_js_1 = require("../3_types.js");
|
|
20
|
+
const _3_types_js_2 = require("../3_types.js");
|
|
20
21
|
const _4_constants_js_1 = require("../4_constants.js");
|
|
21
22
|
const _0_html_js_1 = require("./0_html.js");
|
|
22
23
|
const _0_utilities_js_1 = require("./0_utilities.js");
|
|
@@ -103,7 +104,7 @@ class MessageManager {
|
|
|
103
104
|
default:
|
|
104
105
|
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
105
106
|
}
|
|
106
|
-
const entities = entities_?.length > 0 ? await Promise.all(entities_.map((v) => (0,
|
|
107
|
+
const entities = entities_?.length > 0 ? await Promise.all(entities_.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity))) : undefined;
|
|
107
108
|
return [text, entities];
|
|
108
109
|
}
|
|
109
110
|
async getStickerSetName(inputStickerSet, hash = 0) {
|
|
@@ -119,7 +120,7 @@ class MessageManager {
|
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
async constructMessage(message_, r) {
|
|
122
|
-
return await (0,
|
|
123
|
+
return await (0, _3_types_js_2.constructMessage)(message_, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity, this.getMessage.bind(this), this.getStickerSetName.bind(this), r);
|
|
123
124
|
}
|
|
124
125
|
async forwardMessages(from, to, messageIds, params) {
|
|
125
126
|
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.forwardMessages({
|
|
@@ -201,7 +202,7 @@ class MessageManager {
|
|
|
201
202
|
reply_markup: replyMarkup,
|
|
202
203
|
});
|
|
203
204
|
const message_ = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
204
|
-
return (0,
|
|
205
|
+
return (0, _3_types_js_2.assertMessageType)(message_, "text");
|
|
205
206
|
}
|
|
206
207
|
async sendVenue(chatId, latitude, longitude, title, address, params) {
|
|
207
208
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
@@ -232,7 +233,7 @@ class MessageManager {
|
|
|
232
233
|
message: "",
|
|
233
234
|
});
|
|
234
235
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
235
|
-
return (0,
|
|
236
|
+
return (0, _3_types_js_2.assertMessageType)(message, "venue");
|
|
236
237
|
}
|
|
237
238
|
async sendContact(chatId, firstName, number, params) {
|
|
238
239
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
@@ -258,7 +259,7 @@ class MessageManager {
|
|
|
258
259
|
message: "",
|
|
259
260
|
});
|
|
260
261
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
261
|
-
return (0,
|
|
262
|
+
return (0, _3_types_js_2.assertMessageType)(message, "contact");
|
|
262
263
|
}
|
|
263
264
|
async sendDice(chatId, params) {
|
|
264
265
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
@@ -281,7 +282,7 @@ class MessageManager {
|
|
|
281
282
|
message: "",
|
|
282
283
|
});
|
|
283
284
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
284
|
-
return (0,
|
|
285
|
+
return (0, _3_types_js_2.assertMessageType)(message, "dice");
|
|
285
286
|
}
|
|
286
287
|
async sendLocation(chatId, latitude, longitude, params) {
|
|
287
288
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
@@ -319,10 +320,10 @@ class MessageManager {
|
|
|
319
320
|
message: "",
|
|
320
321
|
});
|
|
321
322
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
322
|
-
return (0,
|
|
323
|
+
return (0, _3_types_js_2.assertMessageType)(message, "location");
|
|
323
324
|
}
|
|
324
325
|
async sendVideoNote(chatId, audio, params) {
|
|
325
|
-
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, audio, params,
|
|
326
|
+
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, audio, params, _3_types_js_2.FileType.VideoNote, [
|
|
326
327
|
new _2_tl_js_1.types.DocumentAttributeVideo({
|
|
327
328
|
round_message: true,
|
|
328
329
|
w: params?.length ?? 0,
|
|
@@ -330,29 +331,29 @@ class MessageManager {
|
|
|
330
331
|
duration: params?.duration ?? 0,
|
|
331
332
|
}),
|
|
332
333
|
], false);
|
|
333
|
-
return (0,
|
|
334
|
+
return (0, _3_types_js_2.assertMessageType)(message, "videoNote");
|
|
334
335
|
}
|
|
335
336
|
async sendAudio(chatId, audio, params) {
|
|
336
|
-
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, audio, params,
|
|
337
|
+
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, audio, params, _3_types_js_2.FileType.Audio, [
|
|
337
338
|
new _2_tl_js_1.types.DocumentAttributeAudio({
|
|
338
339
|
duration: params?.duration ?? 0,
|
|
339
340
|
performer: params?.performer,
|
|
340
341
|
title: params?.title,
|
|
341
342
|
}),
|
|
342
343
|
]);
|
|
343
|
-
return (0,
|
|
344
|
+
return (0, _3_types_js_2.assertMessageType)(message, "audio");
|
|
344
345
|
}
|
|
345
346
|
async sendVoice(chatId, voice, params) {
|
|
346
|
-
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, voice, params,
|
|
347
|
+
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, voice, params, _3_types_js_2.FileType.Voice, [
|
|
347
348
|
new _2_tl_js_1.types.DocumentAttributeAudio({
|
|
348
349
|
voice: true,
|
|
349
350
|
duration: params?.duration ?? 0,
|
|
350
351
|
}),
|
|
351
352
|
]);
|
|
352
|
-
return (0,
|
|
353
|
+
return (0, _3_types_js_2.assertMessageType)(message, "voice");
|
|
353
354
|
}
|
|
354
355
|
async sendAnimation(chatId, animation, params) {
|
|
355
|
-
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, animation, params,
|
|
356
|
+
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, animation, params, _3_types_js_2.FileType.Animation, [
|
|
356
357
|
new _2_tl_js_1.types.DocumentAttributeAnimated(),
|
|
357
358
|
new _2_tl_js_1.types.DocumentAttributeVideo({
|
|
358
359
|
supports_streaming: true,
|
|
@@ -361,10 +362,10 @@ class MessageManager {
|
|
|
361
362
|
duration: params?.duration ?? 0,
|
|
362
363
|
}),
|
|
363
364
|
]);
|
|
364
|
-
return (0,
|
|
365
|
+
return (0, _3_types_js_2.assertMessageType)(message, "animation");
|
|
365
366
|
}
|
|
366
367
|
async sendVideo(chatId, video, params) {
|
|
367
|
-
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, video, params,
|
|
368
|
+
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, video, params, _3_types_js_2.FileType.Video, [
|
|
368
369
|
new _2_tl_js_1.types.DocumentAttributeVideo({
|
|
369
370
|
supports_streaming: params?.supportsStreaming ? true : undefined,
|
|
370
371
|
w: params?.width ?? 0,
|
|
@@ -372,17 +373,17 @@ class MessageManager {
|
|
|
372
373
|
duration: params?.duration ?? 0,
|
|
373
374
|
}),
|
|
374
375
|
]);
|
|
375
|
-
return (0,
|
|
376
|
+
return (0, _3_types_js_2.assertMessageType)(message, "video");
|
|
376
377
|
}
|
|
377
378
|
async sendDocument(chatId, document, params) {
|
|
378
|
-
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, document, params,
|
|
379
|
-
return (0,
|
|
379
|
+
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, document, params, _3_types_js_2.FileType.Document, []);
|
|
380
|
+
return (0, _3_types_js_2.assertMessageType)(message, "document");
|
|
380
381
|
}
|
|
381
382
|
async sendPhoto(chatId, photo, params) {
|
|
382
383
|
let media = null;
|
|
383
384
|
const spoiler = params?.hasSpoiler ? true : undefined;
|
|
384
385
|
if (typeof photo === "string") {
|
|
385
|
-
const fileId = __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveFileId).call(this, photo,
|
|
386
|
+
const fileId = __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveFileId).call(this, photo, _3_types_js_2.FileType.Photo);
|
|
386
387
|
if (fileId != null) {
|
|
387
388
|
media = new _2_tl_js_1.types.InputMediaPhoto({
|
|
388
389
|
id: new _2_tl_js_1.types.InputPhoto(fileId),
|
|
@@ -401,7 +402,7 @@ class MessageManager {
|
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
404
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendMedia).call(this, chatId, media, params);
|
|
404
|
-
return (0,
|
|
405
|
+
return (0, _3_types_js_2.assertMessageType)(message, "photo");
|
|
405
406
|
}
|
|
406
407
|
async sendPoll(chatId, question, options, params) {
|
|
407
408
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
@@ -444,7 +445,7 @@ class MessageManager {
|
|
|
444
445
|
message: "",
|
|
445
446
|
});
|
|
446
447
|
const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
447
|
-
return (0,
|
|
448
|
+
return (0, _3_types_js_2.assertMessageType)(message, "poll");
|
|
448
449
|
}
|
|
449
450
|
async editMessageReplyMarkup(chatId, messageId, params) {
|
|
450
451
|
const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.editMessage({
|
|
@@ -466,7 +467,7 @@ class MessageManager {
|
|
|
466
467
|
reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
|
|
467
468
|
});
|
|
468
469
|
const message_ = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_updatesToMessages).call(this, chatId, result).then((v) => v[0]);
|
|
469
|
-
return (0,
|
|
470
|
+
return (0, _3_types_js_2.assertMessageType)(message_, "text");
|
|
470
471
|
}
|
|
471
472
|
async deleteMessages(chatId, messageIds, params) {
|
|
472
473
|
const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
|
|
@@ -516,7 +517,7 @@ class MessageManager {
|
|
|
516
517
|
async addReaction(chatId, messageId, reaction, params) {
|
|
517
518
|
const chosenReactions = await this.getMessage(chatId, messageId).then((v) => v?.reactions ?? []).then((v) => v.filter((v) => v.chosen));
|
|
518
519
|
for (const r of chosenReactions) {
|
|
519
|
-
if ((0,
|
|
520
|
+
if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
|
|
520
521
|
return;
|
|
521
522
|
}
|
|
522
523
|
}
|
|
@@ -526,7 +527,7 @@ class MessageManager {
|
|
|
526
527
|
async removeReaction(chatId, messageId, reaction) {
|
|
527
528
|
const chosenReactions = await this.getMessage(chatId, messageId).then((v) => v?.reactions ?? []).then((v) => v.filter((v) => v.chosen));
|
|
528
529
|
for (const r of chosenReactions) {
|
|
529
|
-
if ((0,
|
|
530
|
+
if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
|
|
530
531
|
const reactions = chosenReactions.filter((v) => v != r).map((v) => v.reaction);
|
|
531
532
|
await this.setReactions(chatId, messageId, reactions);
|
|
532
533
|
break;
|
|
@@ -534,14 +535,20 @@ class MessageManager {
|
|
|
534
535
|
}
|
|
535
536
|
}
|
|
536
537
|
static canHandleUpdate(update) {
|
|
537
|
-
return update instanceof _2_tl_js_1.types.UpdateNewMessage ||
|
|
538
|
+
return update instanceof _2_tl_js_1.types.UpdateNewMessage ||
|
|
539
|
+
update instanceof _2_tl_js_1.types.UpdateNewChannelMessage ||
|
|
540
|
+
update instanceof _2_tl_js_1.types.UpdateEditMessage ||
|
|
541
|
+
update instanceof _2_tl_js_1.types.UpdateEditChannelMessage ||
|
|
542
|
+
update instanceof _2_tl_js_1.types.UpdateDeleteMessages ||
|
|
543
|
+
update instanceof _2_tl_js_1.types.UpdateDeleteChannelMessages ||
|
|
544
|
+
update instanceof _2_tl_js_1.types.UpdateChannelParticipant ||
|
|
545
|
+
update instanceof _2_tl_js_1.types.UpdateChatParticipant;
|
|
538
546
|
}
|
|
539
547
|
async handleUpdate(update) {
|
|
540
548
|
if (update instanceof _2_tl_js_1.types.UpdateNewMessage || update instanceof _2_tl_js_1.types.UpdateNewChannelMessage || update instanceof _2_tl_js_1.types.UpdateEditMessage || update instanceof _2_tl_js_1.types.UpdateEditChannelMessage) {
|
|
541
549
|
if (update.message instanceof _2_tl_js_1.types.Message || update.message instanceof _2_tl_js_1.types.MessageService) {
|
|
542
550
|
const chatId = (0, _2_tl_js_1.peerToChatId)(update.message.peer_id);
|
|
543
551
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.setMessage(chatId, update.message.id, update.message);
|
|
544
|
-
// promises.push(this.#chatListManager.reassignChatLastMessage(chatId));
|
|
545
552
|
}
|
|
546
553
|
}
|
|
547
554
|
if (update instanceof _2_tl_js_1.types.UpdateNewMessage ||
|
|
@@ -588,6 +595,16 @@ class MessageManager {
|
|
|
588
595
|
}
|
|
589
596
|
return { deletedMessages };
|
|
590
597
|
}
|
|
598
|
+
if (update instanceof _2_tl_js_1.types.UpdateChannelParticipant || update instanceof _2_tl_js_1.types.UpdateChatParticipant) {
|
|
599
|
+
const chatMember = await (0, _3_types_js_1.constructChatMemberUpdated)(update, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity);
|
|
600
|
+
const selfId = await __classPrivateFieldGet(this, _MessageManager_c, "f").getSelfId();
|
|
601
|
+
if (chatMember.oldChatMember.user.id == selfId) {
|
|
602
|
+
return { myChatMember: chatMember };
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
return { chatMember };
|
|
606
|
+
}
|
|
607
|
+
}
|
|
591
608
|
return null;
|
|
592
609
|
}
|
|
593
610
|
async sendChatAction(chatId, action, params) {
|
|
@@ -721,7 +738,7 @@ class MessageManager {
|
|
|
721
738
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.channels.editBanned({
|
|
722
739
|
channel: new _2_tl_js_1.types.InputChannel(chat),
|
|
723
740
|
participant: member,
|
|
724
|
-
banned_rights: (0,
|
|
741
|
+
banned_rights: (0, _3_types_js_2.chatMemberRightsToTlObject)(params?.rights, params?.untilDate),
|
|
725
742
|
});
|
|
726
743
|
}
|
|
727
744
|
async getChatAdministrators(chatId) {
|
|
@@ -740,7 +757,7 @@ class MessageManager {
|
|
|
740
757
|
}
|
|
741
758
|
const chatMembers = new Array();
|
|
742
759
|
for (const p of participants.participants) {
|
|
743
|
-
chatMembers.push(await (0,
|
|
760
|
+
chatMembers.push(await (0, _3_types_js_2.constructChatMember)(p, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity));
|
|
744
761
|
}
|
|
745
762
|
return chatMembers;
|
|
746
763
|
}
|
|
@@ -751,7 +768,7 @@ class MessageManager {
|
|
|
751
768
|
}
|
|
752
769
|
const chatMembers = new Array();
|
|
753
770
|
for (const p of fullChat.full_chat.participants.participants) {
|
|
754
|
-
chatMembers.push(await (0,
|
|
771
|
+
chatMembers.push(await (0, _3_types_js_2.constructChatMember)(p, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity));
|
|
755
772
|
}
|
|
756
773
|
return chatMembers;
|
|
757
774
|
}
|
|
@@ -786,7 +803,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_instances = new WeakSet(), _M
|
|
|
786
803
|
}, _MessageManager_constructReplyMarkup = async function _MessageManager_constructReplyMarkup(params) {
|
|
787
804
|
if (params?.replyMarkup) {
|
|
788
805
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("replyMarkup");
|
|
789
|
-
return (0,
|
|
806
|
+
return (0, _3_types_js_2.replyMarkupToTlObject)(params.replyMarkup, this.usernameResolver.bind(this));
|
|
790
807
|
}
|
|
791
808
|
}, _MessageManager_resolveSendAs = async function _MessageManager_resolveSendAs(params) {
|
|
792
809
|
const sendAs = params?.sendAs;
|
|
@@ -797,7 +814,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_instances = new WeakSet(), _M
|
|
|
797
814
|
}, _MessageManager_constructReplyTo = async function _MessageManager_constructReplyTo(params) {
|
|
798
815
|
const topMsgId = params?.messageThreadId;
|
|
799
816
|
const replyToMsgId = params?.replyToMessageId;
|
|
800
|
-
return replyToMsgId !== undefined ? new _2_tl_js_1.types.InputReplyToMessage({ reply_to_msg_id: replyToMsgId, top_msg_id: topMsgId, quote_text: params?.replyQuote?.text, quote_entities: await Promise.all(params?.replyQuote?.entities.map((v) => (0,
|
|
817
|
+
return replyToMsgId !== undefined ? new _2_tl_js_1.types.InputReplyToMessage({ reply_to_msg_id: replyToMsgId, top_msg_id: topMsgId, quote_text: params?.replyQuote?.text, quote_entities: await Promise.all(params?.replyQuote?.entities.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity)) ?? []), quote_offset: params?.replyQuote?.offset }) : undefined;
|
|
801
818
|
}, _MessageManager_sendDocumentInner = async function _MessageManager_sendDocumentInner(chatId, document, params, fileType, otherAttribs, urlSupported = false) {
|
|
802
819
|
let media = null;
|
|
803
820
|
const spoiler = params?.hasSpoiler ? true : undefined;
|
|
@@ -865,7 +882,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_instances = new WeakSet(), _M
|
|
|
865
882
|
}, _MessageManager_resolveFileId = function _MessageManager_resolveFileId(maybeFileId, expectedFileType) {
|
|
866
883
|
let fileId = null;
|
|
867
884
|
try {
|
|
868
|
-
fileId =
|
|
885
|
+
fileId = _3_types_js_2.FileID.decode(maybeFileId);
|
|
869
886
|
}
|
|
870
887
|
catch (err) {
|
|
871
888
|
d("fileId: %o", err);
|
|
@@ -888,7 +905,7 @@ _MessageManager_c = new WeakMap(), _MessageManager_instances = new WeakSet(), _M
|
|
|
888
905
|
await __classPrivateFieldGet(this, _MessageManager_c, "f").api.messages.sendReaction({
|
|
889
906
|
peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
|
|
890
907
|
msg_id: messageId,
|
|
891
|
-
reaction: reactions.map((v) => (0,
|
|
908
|
+
reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)),
|
|
892
909
|
big: params?.big ? true : undefined,
|
|
893
910
|
add_to_recent: params?.addToRecents ? true : undefined,
|
|
894
911
|
});
|
|
@@ -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
|
|
14
|
-
handleUpdate(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
|
|
14
|
-
handleUpdate(update:
|
|
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
|
|
14
|
-
handleUpdate(update:
|
|
14
|
+
static canHandleUpdate(update: enums.Update): update is InlineQueryManagerUpdate;
|
|
15
|
+
handleUpdate(update: InlineQueryManagerUpdate): Promise<Update>;
|
|
15
16
|
}
|
|
16
17
|
export {};
|
|
@@ -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,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructInviteLink = void 0;
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
+
const _1_user_js_1 = require("./1_user.js");
|
|
7
|
+
async function constructInviteLink(inviteLink_, getEntity) {
|
|
8
|
+
const entity = await getEntity(new _2_tl_js_1.types.PeerUser({ user_id: inviteLink_.admin_id }));
|
|
9
|
+
if (!entity) {
|
|
10
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
11
|
+
}
|
|
12
|
+
const inviteLink = inviteLink_.link;
|
|
13
|
+
const creator = (0, _1_user_js_1.constructUser)(entity);
|
|
14
|
+
const createsJoinRequest = inviteLink_.request_needed ? true : false;
|
|
15
|
+
const revoked = inviteLink_.revoked ? true : false;
|
|
16
|
+
const name = inviteLink_.title;
|
|
17
|
+
const expiresAt = inviteLink_.expire_date ? (0, _1_utilities_js_1.fromUnixTimestamp)(inviteLink_.expire_date) : undefined;
|
|
18
|
+
const limit = inviteLink_.usage_limit ? inviteLink_.usage_limit : undefined;
|
|
19
|
+
const pendingJoinRequestCount = inviteLink_.requested;
|
|
20
|
+
return (0, _1_utilities_js_1.cleanObject)({
|
|
21
|
+
inviteLink,
|
|
22
|
+
creator,
|
|
23
|
+
createsJoinRequest,
|
|
24
|
+
revoked,
|
|
25
|
+
name,
|
|
26
|
+
expiresAt,
|
|
27
|
+
limit,
|
|
28
|
+
pendingJoinRequestCount,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.constructInviteLink = constructInviteLink;
|
|
@@ -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,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructChatMemberUpdated = void 0;
|
|
4
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
5
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
6
|
+
const _1_chat_p_js_1 = require("./1_chat_p.js");
|
|
7
|
+
const _1_user_js_1 = require("./1_user.js");
|
|
8
|
+
const _2_chat_member_js_1 = require("./2_chat_member.js");
|
|
9
|
+
const _2_invite_link_js_1 = require("./2_invite_link.js");
|
|
10
|
+
async function constructChatMemberUpdated(update, getEntity) {
|
|
11
|
+
if (!update.prev_participant && !update.new_participant) {
|
|
12
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
13
|
+
}
|
|
14
|
+
const chat_ = await getEntity("channel_id" in update ? new _2_tl_js_1.types.PeerChannel(update) : new _2_tl_js_1.types.PeerChat(update));
|
|
15
|
+
const from_ = await getEntity(new _2_tl_js_1.types.PeerUser({ user_id: update.actor_id }));
|
|
16
|
+
if (!chat_ || !from_) {
|
|
17
|
+
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
18
|
+
}
|
|
19
|
+
const userPeer = new _2_tl_js_1.types.PeerUser(update);
|
|
20
|
+
const chat = (0, _1_chat_p_js_1.constructChatP)(chat_);
|
|
21
|
+
const from = (0, _1_user_js_1.constructUser)(from_);
|
|
22
|
+
const date = (0, _1_utilities_js_1.fromUnixTimestamp)(update.date);
|
|
23
|
+
const oldChatMember = await (0, _2_chat_member_js_1.constructChatMember)(update.prev_participant ?? new _2_tl_js_1.types.ChannelParticipantLeft({ peer: userPeer }), getEntity);
|
|
24
|
+
const newChatMember = await (0, _2_chat_member_js_1.constructChatMember)(update.new_participant ?? new _2_tl_js_1.types.ChannelParticipantLeft({ peer: userPeer }), getEntity);
|
|
25
|
+
const viaSharedFolder = "via_chatlist" in update ? update.via_chatlist ? true : update.invite ? false : undefined : undefined;
|
|
26
|
+
const inviteLink = (update.invite && update.invite instanceof _2_tl_js_1.types.ChatInviteExported) ? await (0, _2_invite_link_js_1.constructInviteLink)(update.invite, getEntity) : undefined;
|
|
27
|
+
return (0, _1_utilities_js_1.cleanObject)({
|
|
28
|
+
chat,
|
|
29
|
+
from,
|
|
30
|
+
date,
|
|
31
|
+
oldChatMember,
|
|
32
|
+
newChatMember,
|
|
33
|
+
viaSharedFolder,
|
|
34
|
+
inviteLink,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.constructChatMemberUpdated = constructChatMemberUpdated;
|
|
@@ -88,7 +88,7 @@ export interface _MessageBase {
|
|
|
88
88
|
* Properties shared between media message types.
|
|
89
89
|
* @unlisted
|
|
90
90
|
*/
|
|
91
|
-
export interface
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
155
|
+
export interface MessageAudio extends _MessageMediaBase {
|
|
156
156
|
/** The audio included in the message. */
|
|
157
157
|
audio: Audio;
|
|
158
158
|
}
|
|
@@ -6,6 +6,7 @@ import { InlineQuery } from "./2_inline_query.js";
|
|
|
6
6
|
import { MessageInteractions } from "./2_message_interactions.js";
|
|
7
7
|
import { MessageReactionCount } from "./2_message_reaction_count.js";
|
|
8
8
|
import { MessageReactions } from "./2_message_reactions.js";
|
|
9
|
+
import { ChatMemberUpdated } from "./3_chat_member_updated.js";
|
|
9
10
|
import { Message } from "./4_message.js";
|
|
10
11
|
import { CallbackQuery } from "./5_callback_query.js";
|
|
11
12
|
import { Chat } from "./5_chat.js";
|
|
@@ -183,6 +184,20 @@ export interface UpdateMessageReactionCount {
|
|
|
183
184
|
export interface UpdateMessageReactions {
|
|
184
185
|
messageReactions: MessageReactions;
|
|
185
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* The status of a chat member was changed.
|
|
189
|
+
* @unlisted
|
|
190
|
+
*/
|
|
191
|
+
export interface UpdateChatMember {
|
|
192
|
+
chatMember: ChatMemberUpdated;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The status of a current account was changed in a chat.
|
|
196
|
+
* @unlisted
|
|
197
|
+
*/
|
|
198
|
+
export interface UpdateMyChatMember {
|
|
199
|
+
myChatMember: ChatMemberUpdated;
|
|
200
|
+
}
|
|
186
201
|
/** @unlisted */
|
|
187
202
|
export interface UpdateMap {
|
|
188
203
|
message: UpdateNewMessage;
|
|
@@ -199,8 +214,10 @@ export interface UpdateMap {
|
|
|
199
214
|
messageInteractions: UpdateMessageInteractions;
|
|
200
215
|
messageReactionCount: UpdateMessageReactionCount;
|
|
201
216
|
messageReactions: UpdateMessageReactions;
|
|
217
|
+
chatMember: UpdateChatMember;
|
|
218
|
+
myChatMember: UpdateMyChatMember;
|
|
202
219
|
}
|
|
203
220
|
/** @unlisted */
|
|
204
|
-
export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions>;
|
|
221
|
+
export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember>;
|
|
205
222
|
/** An incoming update. */
|
|
206
|
-
export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions;
|
|
223
|
+
export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember;
|