@mtcute/core 0.31.0 → 0.32.0
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/client.cjs +12 -0
- package/client.js +12 -0
- package/highlevel/client.d.cts +74 -9
- package/highlevel/client.d.ts +74 -9
- package/highlevel/methods/chats/build-peers-index.cjs +45 -0
- package/highlevel/methods/chats/build-peers-index.d.cts +13 -0
- package/highlevel/methods/chats/build-peers-index.d.ts +13 -0
- package/highlevel/methods/chats/build-peers-index.js +40 -0
- package/highlevel/methods/ephemeral/delete-all-welcome-messages.cjs +17 -0
- package/highlevel/methods/ephemeral/delete-all-welcome-messages.d.cts +8 -0
- package/highlevel/methods/ephemeral/delete-all-welcome-messages.d.ts +8 -0
- package/highlevel/methods/ephemeral/delete-all-welcome-messages.js +12 -0
- package/highlevel/methods/ephemeral/delete-ephemeral-message.cjs +1 -1
- package/highlevel/methods/ephemeral/delete-ephemeral-message.d.cts +2 -2
- package/highlevel/methods/ephemeral/delete-ephemeral-message.d.ts +2 -2
- package/highlevel/methods/ephemeral/delete-ephemeral-message.js +1 -1
- package/highlevel/methods/ephemeral/delete-welcome-message.cjs +18 -0
- package/highlevel/methods/ephemeral/delete-welcome-message.d.cts +9 -0
- package/highlevel/methods/ephemeral/delete-welcome-message.d.ts +9 -0
- package/highlevel/methods/ephemeral/delete-welcome-message.js +13 -0
- package/highlevel/methods/ephemeral/edit-ephemeral-message.cjs +11 -3
- package/highlevel/methods/ephemeral/edit-ephemeral-message.d.cts +16 -2
- package/highlevel/methods/ephemeral/edit-ephemeral-message.d.ts +16 -2
- package/highlevel/methods/ephemeral/edit-ephemeral-message.js +11 -3
- package/highlevel/methods/ephemeral/get-welcome-messages.cjs +29 -0
- package/highlevel/methods/ephemeral/get-welcome-messages.d.cts +8 -0
- package/highlevel/methods/ephemeral/get-welcome-messages.d.ts +8 -0
- package/highlevel/methods/ephemeral/get-welcome-messages.js +24 -0
- package/highlevel/methods/ephemeral/send-ephemeral-message.cjs +13 -3
- package/highlevel/methods/ephemeral/send-ephemeral-message.d.cts +20 -2
- package/highlevel/methods/ephemeral/send-ephemeral-message.d.ts +20 -2
- package/highlevel/methods/ephemeral/send-ephemeral-message.js +13 -3
- package/highlevel/methods/files/download-iterable.cjs +3 -0
- package/highlevel/methods/files/download-iterable.js +3 -0
- package/highlevel/methods/files/normalize-input-media.cjs +25 -4
- package/highlevel/methods/files/normalize-input-media.js +25 -4
- package/highlevel/methods/forums/edit-forum-topic.cjs +1 -1
- package/highlevel/methods/forums/edit-forum-topic.js +1 -1
- package/highlevel/methods/forums/toggle-forum-topic-closed.cjs +1 -1
- package/highlevel/methods/forums/toggle-forum-topic-closed.js +1 -1
- package/highlevel/methods/forums/toggle-general-topic-hidden.cjs +1 -1
- package/highlevel/methods/forums/toggle-general-topic-hidden.js +1 -1
- package/highlevel/methods/gifts/buy-resale-gift.cjs +5 -2
- package/highlevel/methods/gifts/buy-resale-gift.d.cts +11 -1
- package/highlevel/methods/gifts/buy-resale-gift.d.ts +11 -1
- package/highlevel/methods/gifts/buy-resale-gift.js +5 -2
- package/highlevel/methods/messages/forward-messages.cjs +1 -0
- package/highlevel/methods/messages/forward-messages.d.cts +2 -0
- package/highlevel/methods/messages/forward-messages.d.ts +2 -0
- package/highlevel/methods/messages/forward-messages.js +1 -0
- package/highlevel/methods/messages/normalize-rich-message.cjs +3 -0
- package/highlevel/methods/messages/normalize-rich-message.js +3 -0
- package/highlevel/methods/messages/send-text.cjs +2 -33
- package/highlevel/methods/messages/send-text.js +2 -33
- package/highlevel/methods/messages/send-typing.d.cts +3 -3
- package/highlevel/methods/messages/send-typing.d.ts +3 -3
- package/highlevel/methods/messages/set-typing.cjs +1 -1
- package/highlevel/methods/messages/set-typing.d.cts +2 -2
- package/highlevel/methods/messages/set-typing.d.ts +2 -2
- package/highlevel/methods/messages/set-typing.js +1 -1
- package/highlevel/methods.d.cts +3 -0
- package/highlevel/methods.d.ts +3 -0
- package/highlevel/types/bots/keyboards/builder.cjs +5 -5
- package/highlevel/types/bots/keyboards/builder.d.cts +8 -9
- package/highlevel/types/bots/keyboards/builder.d.ts +8 -9
- package/highlevel/types/bots/keyboards/builder.js +5 -5
- package/highlevel/types/bots/keyboards/factories.cjs +51 -103
- package/highlevel/types/bots/keyboards/factories.d.cts +58 -89
- package/highlevel/types/bots/keyboards/factories.d.ts +58 -89
- package/highlevel/types/bots/keyboards/factories.js +51 -103
- package/highlevel/types/bots/keyboards/index.d.cts +3 -3
- package/highlevel/types/bots/keyboards/index.d.ts +3 -3
- package/highlevel/types/bots/keyboards/normalize.cjs +131 -0
- package/highlevel/types/bots/keyboards/normalize.d.cts +10 -0
- package/highlevel/types/bots/keyboards/normalize.d.ts +10 -0
- package/highlevel/types/bots/keyboards/normalize.js +126 -0
- package/highlevel/types/bots/keyboards/types.d.cts +160 -4
- package/highlevel/types/bots/keyboards/types.d.ts +160 -4
- package/highlevel/types/messages/dialog.cjs +8 -1
- package/highlevel/types/messages/dialog.d.cts +3 -0
- package/highlevel/types/messages/dialog.d.ts +3 -0
- package/highlevel/types/messages/dialog.js +8 -1
- package/highlevel/types/messages/dialog.test.d.cts +1 -0
- package/highlevel/types/messages/dialog.test.d.ts +1 -0
- package/highlevel/types/messages/ephemeral-message.cjs +35 -3
- package/highlevel/types/messages/ephemeral-message.d.cts +22 -2
- package/highlevel/types/messages/ephemeral-message.d.ts +22 -2
- package/highlevel/types/messages/ephemeral-message.js +35 -3
- package/highlevel/types/messages/message-action.cjs +8 -1
- package/highlevel/types/messages/message-action.d.cts +11 -1
- package/highlevel/types/messages/message-action.d.ts +11 -1
- package/highlevel/types/messages/message-action.js +8 -1
- package/highlevel/types/messages/message.cjs +7 -2
- package/highlevel/types/messages/message.d.cts +2 -2
- package/highlevel/types/messages/message.d.ts +2 -2
- package/highlevel/types/messages/message.js +8 -3
- package/highlevel/types/messages/rich/inner.cjs +37 -0
- package/highlevel/types/messages/rich/inner.d.cts +19 -0
- package/highlevel/types/messages/rich/inner.d.ts +19 -0
- package/highlevel/types/messages/rich/inner.js +37 -0
- package/highlevel/types/peers/full-chat.cjs +4 -0
- package/highlevel/types/peers/full-chat.d.cts +2 -0
- package/highlevel/types/peers/full-chat.d.ts +2 -0
- package/highlevel/types/peers/full-chat.js +4 -0
- package/highlevel/types/peers/typing-status.d.cts +4 -1
- package/highlevel/types/peers/typing-status.d.ts +4 -1
- package/highlevel/types/updates/ephemeral-callback-query.cjs +10 -2
- package/highlevel/types/updates/ephemeral-callback-query.d.cts +8 -2
- package/highlevel/types/updates/ephemeral-callback-query.d.ts +8 -2
- package/highlevel/types/updates/ephemeral-callback-query.js +10 -2
- package/highlevel/types/updates/user-typing-update.cjs +18 -0
- package/highlevel/types/updates/user-typing-update.d.cts +9 -0
- package/highlevel/types/updates/user-typing-update.d.ts +9 -0
- package/highlevel/types/updates/user-typing-update.js +18 -0
- package/highlevel/updates/manager.cjs +40 -28
- package/highlevel/updates/manager.js +40 -28
- package/highlevel/utils/walk-page-blocks.cjs +5 -0
- package/highlevel/utils/walk-page-blocks.js +5 -0
- package/methods.cjs +6 -0
- package/methods.js +6 -0
- package/network/mtproto-session.cjs +9 -2
- package/network/mtproto-session.d.cts +3 -1
- package/network/mtproto-session.d.ts +3 -1
- package/network/mtproto-session.js +9 -2
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/network/session-connection.cjs +12 -6
- package/network/session-connection.js +12 -6
- package/network/session-connection.test.d.cts +1 -0
- package/network/session-connection.test.d.ts +1 -0
- package/package.json +3 -3
- package/tl/api-schema.json +1 -1
- package/tl/binary/reader.cjs +136 -93
- package/tl/binary/reader.js +136 -93
- package/tl/binary/writer.cjs +318 -207
- package/tl/binary/writer.js +318 -207
- package/tl/compat/reader.cjs +82 -0
- package/tl/compat/reader.js +82 -0
- package/tl/index.d.cts +377 -718
- package/tl/index.d.ts +377 -718
- package/tl/inner-tl.cjs +23 -7
- package/tl/inner-tl.js +23 -7
- package/tl/rpc-error.test.d.cts +1 -0
- package/tl/rpc-error.test.d.ts +1 -0
- package/utils/binary/compat.cjs +175 -29
- package/utils/binary/compat.js +175 -29
- package/utils/links/bots.cjs +9 -4
- package/utils/links/bots.js +9 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Delete a welcome message configured for a chat
|
|
5
|
+
*
|
|
6
|
+
* @param chatId Chat where the welcome message is configured
|
|
7
|
+
* @param messageId ID of the welcome message to delete
|
|
8
|
+
*/
|
|
9
|
+
export declare function deleteWelcomeMessage(client: ITelegramClient, chatId: InputPeerLike, messageId: number): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Delete a welcome message configured for a chat
|
|
5
|
+
*
|
|
6
|
+
* @param chatId Chat where the welcome message is configured
|
|
7
|
+
* @param messageId ID of the welcome message to delete
|
|
8
|
+
*/
|
|
9
|
+
export declare function deleteWelcomeMessage(client: ITelegramClient, chatId: InputPeerLike, messageId: number): Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { assertTrue } from "../../../utils/type-assertions.js";
|
|
2
|
+
import { resolvePeer } from "../users/resolve-peer.js";
|
|
3
|
+
async function deleteWelcomeMessage(client, chatId, messageId) {
|
|
4
|
+
const r = await client.call({
|
|
5
|
+
_: "ephemeral.deleteWelcomeMessage",
|
|
6
|
+
peer: await resolvePeer(client, chatId),
|
|
7
|
+
id: messageId
|
|
8
|
+
});
|
|
9
|
+
assertTrue("ephemeral.deleteWelcomeMessage", r);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
deleteWelcomeMessage
|
|
13
|
+
};
|
|
@@ -5,19 +5,24 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const errors = require("../../../types/errors.cjs");
|
|
8
9
|
const normalizeInputMedia = require("../files/normalize-input-media.cjs");
|
|
10
|
+
const normalizeRichMessage = require("../messages/normalize-rich-message.cjs");
|
|
9
11
|
const normalizeText = require("../misc/normalize-text.cjs");
|
|
10
12
|
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
11
13
|
const findInUpdate = require("./find-in-update.cjs");
|
|
12
14
|
const factories = require("../../types/bots/keyboards/factories.cjs");
|
|
13
15
|
async function editEphemeralMessage(client, params) {
|
|
14
|
-
const { chatId, receiverId, messageId, text, media, replyMarkup, shouldDispatch } = params;
|
|
16
|
+
const { chatId, receiverId, messageId, text, media, richMessage, replyMarkup, shouldDispatch, uploadCache } = params;
|
|
15
17
|
let message;
|
|
16
18
|
let entities;
|
|
17
19
|
if (text !== void 0) {
|
|
18
20
|
[message, entities] = await normalizeText._normalizeInputText(client, text);
|
|
19
21
|
}
|
|
20
|
-
const peer = await resolvePeer.resolvePeer(client, chatId);
|
|
22
|
+
const peer = chatId !== null ? await resolvePeer.resolvePeer(client, chatId) : void 0;
|
|
23
|
+
if (richMessage && !peer) {
|
|
24
|
+
throw new errors.MtArgumentError("richMessage requires chatId to be passed");
|
|
25
|
+
}
|
|
21
26
|
const res = await client.call({
|
|
22
27
|
_: "ephemeral.editMessage",
|
|
23
28
|
peer,
|
|
@@ -26,7 +31,10 @@ async function editEphemeralMessage(client, params) {
|
|
|
26
31
|
message,
|
|
27
32
|
entities,
|
|
28
33
|
media: media ? await normalizeInputMedia._normalizeInputMedia(client, media, { uploadPeer: peer }) : void 0,
|
|
29
|
-
|
|
34
|
+
richMessage: richMessage ? await normalizeRichMessage._normalizeInputRichMessage(client, peer, richMessage, { uploadCache }) : void 0,
|
|
35
|
+
replyMarkup: factories._convertToTl(replyMarkup),
|
|
36
|
+
welcome: params.welcome,
|
|
37
|
+
invertMedia: params.invertMedia
|
|
30
38
|
});
|
|
31
39
|
return findInUpdate._findEphemeralMessageInUpdate(client, res, true, !shouldDispatch);
|
|
32
40
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
2
|
import { ReplyMarkup } from '../../types/bots/keyboards/index.js';
|
|
3
3
|
import { EphemeralMessage, InputMediaLike, InputPeerLike, InputText } from '../../types/index.js';
|
|
4
|
+
import { InputRichMessage, RichMediaUploadCache } from '../../types/messages/rich/types.js';
|
|
4
5
|
/**
|
|
5
6
|
* Edit a previously sent ephemeral message
|
|
6
7
|
*/
|
|
7
8
|
export declare function editEphemeralMessage(client: ITelegramClient, params: {
|
|
8
|
-
/** Chat where the message was sent */
|
|
9
|
-
chatId: InputPeerLike;
|
|
9
|
+
/** Chat where the message was sent (`null` for guest chats) */
|
|
10
|
+
chatId: InputPeerLike | null;
|
|
10
11
|
/** User the message is visible to */
|
|
11
12
|
receiverId: InputPeerLike;
|
|
12
13
|
/** ID of the message to edit */
|
|
@@ -15,8 +16,21 @@ export declare function editEphemeralMessage(client: ITelegramClient, params: {
|
|
|
15
16
|
text?: InputText;
|
|
16
17
|
/** New media of the message */
|
|
17
18
|
media?: InputMediaLike;
|
|
19
|
+
/** New rich message content of the message */
|
|
20
|
+
richMessage?: InputRichMessage;
|
|
18
21
|
/** New reply markup of the message */
|
|
19
22
|
replyMarkup?: ReplyMarkup;
|
|
23
|
+
/** Whether this message is a welcome message template for the chat */
|
|
24
|
+
welcome?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to invert the media position.
|
|
27
|
+
*
|
|
28
|
+
* Currently only supported for web previews and makes the
|
|
29
|
+
* client render the preview above the caption and not below.
|
|
30
|
+
*/
|
|
31
|
+
invertMedia?: boolean;
|
|
32
|
+
/** Cache for the uploaded rich message media, see {@link createRichStreamingDraft} */
|
|
33
|
+
uploadCache?: RichMediaUploadCache;
|
|
20
34
|
/**
|
|
21
35
|
* Whether to dispatch the returned updates
|
|
22
36
|
* to the client's update handler.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
2
|
import { ReplyMarkup } from '../../types/bots/keyboards/index.js';
|
|
3
3
|
import { EphemeralMessage, InputMediaLike, InputPeerLike, InputText } from '../../types/index.js';
|
|
4
|
+
import { InputRichMessage, RichMediaUploadCache } from '../../types/messages/rich/types.js';
|
|
4
5
|
/**
|
|
5
6
|
* Edit a previously sent ephemeral message
|
|
6
7
|
*/
|
|
7
8
|
export declare function editEphemeralMessage(client: ITelegramClient, params: {
|
|
8
|
-
/** Chat where the message was sent */
|
|
9
|
-
chatId: InputPeerLike;
|
|
9
|
+
/** Chat where the message was sent (`null` for guest chats) */
|
|
10
|
+
chatId: InputPeerLike | null;
|
|
10
11
|
/** User the message is visible to */
|
|
11
12
|
receiverId: InputPeerLike;
|
|
12
13
|
/** ID of the message to edit */
|
|
@@ -15,8 +16,21 @@ export declare function editEphemeralMessage(client: ITelegramClient, params: {
|
|
|
15
16
|
text?: InputText;
|
|
16
17
|
/** New media of the message */
|
|
17
18
|
media?: InputMediaLike;
|
|
19
|
+
/** New rich message content of the message */
|
|
20
|
+
richMessage?: InputRichMessage;
|
|
18
21
|
/** New reply markup of the message */
|
|
19
22
|
replyMarkup?: ReplyMarkup;
|
|
23
|
+
/** Whether this message is a welcome message template for the chat */
|
|
24
|
+
welcome?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to invert the media position.
|
|
27
|
+
*
|
|
28
|
+
* Currently only supported for web previews and makes the
|
|
29
|
+
* client render the preview above the caption and not below.
|
|
30
|
+
*/
|
|
31
|
+
invertMedia?: boolean;
|
|
32
|
+
/** Cache for the uploaded rich message media, see {@link createRichStreamingDraft} */
|
|
33
|
+
uploadCache?: RichMediaUploadCache;
|
|
20
34
|
/**
|
|
21
35
|
* Whether to dispatch the returned updates
|
|
22
36
|
* to the client's update handler.
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
import { MtArgumentError } from "../../../types/errors.js";
|
|
1
2
|
import { _normalizeInputMedia } from "../files/normalize-input-media.js";
|
|
3
|
+
import { _normalizeInputRichMessage } from "../messages/normalize-rich-message.js";
|
|
2
4
|
import { _normalizeInputText } from "../misc/normalize-text.js";
|
|
3
5
|
import { resolvePeer, resolveUser } from "../users/resolve-peer.js";
|
|
4
6
|
import { _findEphemeralMessageInUpdate } from "./find-in-update.js";
|
|
5
7
|
import { _convertToTl } from "../../types/bots/keyboards/factories.js";
|
|
6
8
|
async function editEphemeralMessage(client, params) {
|
|
7
|
-
const { chatId, receiverId, messageId, text, media, replyMarkup, shouldDispatch } = params;
|
|
9
|
+
const { chatId, receiverId, messageId, text, media, richMessage, replyMarkup, shouldDispatch, uploadCache } = params;
|
|
8
10
|
let message;
|
|
9
11
|
let entities;
|
|
10
12
|
if (text !== void 0) {
|
|
11
13
|
[message, entities] = await _normalizeInputText(client, text);
|
|
12
14
|
}
|
|
13
|
-
const peer = await resolvePeer(client, chatId);
|
|
15
|
+
const peer = chatId !== null ? await resolvePeer(client, chatId) : void 0;
|
|
16
|
+
if (richMessage && !peer) {
|
|
17
|
+
throw new MtArgumentError("richMessage requires chatId to be passed");
|
|
18
|
+
}
|
|
14
19
|
const res = await client.call({
|
|
15
20
|
_: "ephemeral.editMessage",
|
|
16
21
|
peer,
|
|
@@ -19,7 +24,10 @@ async function editEphemeralMessage(client, params) {
|
|
|
19
24
|
message,
|
|
20
25
|
entities,
|
|
21
26
|
media: media ? await _normalizeInputMedia(client, media, { uploadPeer: peer }) : void 0,
|
|
22
|
-
|
|
27
|
+
richMessage: richMessage ? await _normalizeInputRichMessage(client, peer, richMessage, { uploadCache }) : void 0,
|
|
28
|
+
replyMarkup: _convertToTl(replyMarkup),
|
|
29
|
+
welcome: params.welcome,
|
|
30
|
+
invertMedia: params.invertMedia
|
|
23
31
|
});
|
|
24
32
|
return _findEphemeralMessageInUpdate(client, res, true, !shouldDispatch);
|
|
25
33
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const Long = require("long");
|
|
9
|
+
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
10
|
+
const buildPeersIndex = require("../chats/build-peers-index.cjs");
|
|
11
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
12
|
+
const ephemeralMessage = require("../../types/messages/ephemeral-message.cjs");
|
|
13
|
+
async function getWelcomeMessages(client, chatId) {
|
|
14
|
+
const peer = await resolvePeer.resolvePeer(client, chatId);
|
|
15
|
+
const res = await client.call({
|
|
16
|
+
_: "ephemeral.getWelcomeMessages",
|
|
17
|
+
peer,
|
|
18
|
+
hash: Long.ZERO
|
|
19
|
+
});
|
|
20
|
+
typeAssertions.assertTypeIsNot("getWelcomeMessages", res, "ephemeral.welcomeMessagesNotModified");
|
|
21
|
+
const peersToFetch = [peer];
|
|
22
|
+
for (const msg of res.messages) {
|
|
23
|
+
peersToFetch.push(msg.fromId);
|
|
24
|
+
if (msg.peerId) peersToFetch.push(msg.peerId);
|
|
25
|
+
}
|
|
26
|
+
const peers = await buildPeersIndex._buildPeersIndex(client, "getWelcomeMessages", peersToFetch);
|
|
27
|
+
return res.messages.map((it) => new ephemeralMessage.EphemeralMessage(it, peers));
|
|
28
|
+
}
|
|
29
|
+
exports.getWelcomeMessages = getWelcomeMessages;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike, EphemeralMessage } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get the welcome messages configured for a chat
|
|
5
|
+
*
|
|
6
|
+
* @param chatId Chat to get the welcome messages for
|
|
7
|
+
*/
|
|
8
|
+
export declare function getWelcomeMessages(client: ITelegramClient, chatId: InputPeerLike): Promise<EphemeralMessage[]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike, EphemeralMessage } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get the welcome messages configured for a chat
|
|
5
|
+
*
|
|
6
|
+
* @param chatId Chat to get the welcome messages for
|
|
7
|
+
*/
|
|
8
|
+
export declare function getWelcomeMessages(client: ITelegramClient, chatId: InputPeerLike): Promise<EphemeralMessage[]>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import { assertTypeIsNot } from "../../../utils/type-assertions.js";
|
|
3
|
+
import { _buildPeersIndex } from "../chats/build-peers-index.js";
|
|
4
|
+
import { resolvePeer } from "../users/resolve-peer.js";
|
|
5
|
+
import { EphemeralMessage as EphemeralMessage$2 } from "../../types/messages/ephemeral-message.js";
|
|
6
|
+
async function getWelcomeMessages(client, chatId) {
|
|
7
|
+
const peer = await resolvePeer(client, chatId);
|
|
8
|
+
const res = await client.call({
|
|
9
|
+
_: "ephemeral.getWelcomeMessages",
|
|
10
|
+
peer,
|
|
11
|
+
hash: Long.ZERO
|
|
12
|
+
});
|
|
13
|
+
assertTypeIsNot("getWelcomeMessages", res, "ephemeral.welcomeMessagesNotModified");
|
|
14
|
+
const peersToFetch = [peer];
|
|
15
|
+
for (const msg of res.messages) {
|
|
16
|
+
peersToFetch.push(msg.fromId);
|
|
17
|
+
if (msg.peerId) peersToFetch.push(msg.peerId);
|
|
18
|
+
}
|
|
19
|
+
const peers = await _buildPeersIndex(client, "getWelcomeMessages", peersToFetch);
|
|
20
|
+
return res.messages.map((it) => new EphemeralMessage$2(it, peers));
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
getWelcomeMessages
|
|
24
|
+
};
|
|
@@ -5,16 +5,21 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const errors = require("../../../types/errors.cjs");
|
|
8
9
|
const longUtils = require("../../../utils/long-utils.cjs");
|
|
9
10
|
const normalizeInputMedia = require("../files/normalize-input-media.cjs");
|
|
11
|
+
const normalizeRichMessage = require("../messages/normalize-rich-message.cjs");
|
|
10
12
|
const normalizeText = require("../misc/normalize-text.cjs");
|
|
11
13
|
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
12
14
|
const findInUpdate = require("./find-in-update.cjs");
|
|
13
15
|
const factories = require("../../types/bots/keyboards/factories.cjs");
|
|
14
16
|
async function sendEphemeralMessage(client, chatId, receiverId, text, params) {
|
|
15
|
-
const { media, replyTo, replyToEphemeral, queryId, shouldDispatch } = params ?? {};
|
|
17
|
+
const { media, richMessage, replyTo, replyToEphemeral, queryId, shouldDispatch, uploadCache } = params ?? {};
|
|
16
18
|
const [message, entities] = await normalizeText._normalizeInputText(client, text);
|
|
17
|
-
const peer = await resolvePeer.resolvePeer(client, chatId);
|
|
19
|
+
const peer = chatId !== null ? await resolvePeer.resolvePeer(client, chatId) : void 0;
|
|
20
|
+
if (richMessage && !peer) {
|
|
21
|
+
throw new errors.MtArgumentError("richMessage requires chatId to be passed");
|
|
22
|
+
}
|
|
18
23
|
let replyToTl;
|
|
19
24
|
if (replyTo !== void 0) {
|
|
20
25
|
replyToTl = { _: "inputReplyToMessage", replyToMsgId: replyTo };
|
|
@@ -29,9 +34,14 @@ async function sendEphemeralMessage(client, chatId, receiverId, text, params) {
|
|
|
29
34
|
message,
|
|
30
35
|
entities,
|
|
31
36
|
media: media ? await normalizeInputMedia._normalizeInputMedia(client, media, { uploadPeer: peer }) : void 0,
|
|
37
|
+
richMessage: richMessage ? await normalizeRichMessage._normalizeInputRichMessage(client, peer, richMessage, { uploadCache }) : void 0,
|
|
32
38
|
replyMarkup: factories._convertToTl(params?.replyMarkup),
|
|
33
39
|
randomId: longUtils.randomLong(),
|
|
34
|
-
replyTo: replyToTl
|
|
40
|
+
replyTo: replyToTl,
|
|
41
|
+
welcome: params?.welcome,
|
|
42
|
+
anchor: params?.anchor,
|
|
43
|
+
invertMedia: params?.invertMedia,
|
|
44
|
+
noforwards: params?.forbidForwards
|
|
35
45
|
});
|
|
36
46
|
return findInUpdate._findEphemeralMessageInUpdate(client, res, false, !shouldDispatch);
|
|
37
47
|
}
|
|
@@ -2,17 +2,20 @@ import { tl } from '../../../tl/index.js';
|
|
|
2
2
|
import { ITelegramClient } from '../../client.types.js';
|
|
3
3
|
import { ReplyMarkup } from '../../types/bots/keyboards/index.js';
|
|
4
4
|
import { EphemeralMessage, InputMediaLike, InputPeerLike, InputText } from '../../types/index.js';
|
|
5
|
+
import { InputRichMessage, RichMediaUploadCache } from '../../types/messages/rich/types.js';
|
|
5
6
|
/**
|
|
6
7
|
* Send an ephemeral message — a message that is only visible
|
|
7
8
|
* to a single user in a chat and is not persisted in the chat history.
|
|
8
9
|
*
|
|
9
|
-
* @param chatId ID of the chat to send the message to
|
|
10
|
+
* @param chatId ID of the chat to send the message to (`null` for guest chats, where `queryId` is used instead)
|
|
10
11
|
* @param receiverId ID of the user the message should be visible to
|
|
11
12
|
* @param text Text of the message
|
|
12
13
|
*/
|
|
13
|
-
export declare function sendEphemeralMessage(client: ITelegramClient, chatId: InputPeerLike, receiverId: InputPeerLike, text: InputText, params?: {
|
|
14
|
+
export declare function sendEphemeralMessage(client: ITelegramClient, chatId: InputPeerLike | null, receiverId: InputPeerLike, text: InputText, params?: {
|
|
14
15
|
/** Media to be attached to the message */
|
|
15
16
|
media?: InputMediaLike;
|
|
17
|
+
/** Rich message content to be sent instead of the plain text */
|
|
18
|
+
richMessage?: InputRichMessage;
|
|
16
19
|
/** Message to reply to */
|
|
17
20
|
replyTo?: number;
|
|
18
21
|
/** Ephemeral message to reply to */
|
|
@@ -21,6 +24,21 @@ export declare function sendEphemeralMessage(client: ITelegramClient, chatId: In
|
|
|
21
24
|
replyMarkup?: ReplyMarkup;
|
|
22
25
|
/** For guest chat bots, ID of the query that this message is sent in response to */
|
|
23
26
|
queryId?: tl.Long;
|
|
27
|
+
/** Whether to send this message as a welcome message template for the chat */
|
|
28
|
+
welcome?: boolean;
|
|
29
|
+
/** Whether to anchor this message to the message it replies to */
|
|
30
|
+
anchor?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to invert the media position.
|
|
33
|
+
*
|
|
34
|
+
* Currently only supported for web previews and makes the
|
|
35
|
+
* client render the preview above the caption and not below.
|
|
36
|
+
*/
|
|
37
|
+
invertMedia?: boolean;
|
|
38
|
+
/** Whether to forbid forwarding this message */
|
|
39
|
+
forbidForwards?: boolean;
|
|
40
|
+
/** Cache for the uploaded rich message media, see {@link createRichStreamingDraft} */
|
|
41
|
+
uploadCache?: RichMediaUploadCache;
|
|
24
42
|
/**
|
|
25
43
|
* Whether to dispatch the returned updates
|
|
26
44
|
* to the client's update handler.
|
|
@@ -2,17 +2,20 @@ import { tl } from '../../../tl/index.js';
|
|
|
2
2
|
import { ITelegramClient } from '../../client.types.js';
|
|
3
3
|
import { ReplyMarkup } from '../../types/bots/keyboards/index.js';
|
|
4
4
|
import { EphemeralMessage, InputMediaLike, InputPeerLike, InputText } from '../../types/index.js';
|
|
5
|
+
import { InputRichMessage, RichMediaUploadCache } from '../../types/messages/rich/types.js';
|
|
5
6
|
/**
|
|
6
7
|
* Send an ephemeral message — a message that is only visible
|
|
7
8
|
* to a single user in a chat and is not persisted in the chat history.
|
|
8
9
|
*
|
|
9
|
-
* @param chatId ID of the chat to send the message to
|
|
10
|
+
* @param chatId ID of the chat to send the message to (`null` for guest chats, where `queryId` is used instead)
|
|
10
11
|
* @param receiverId ID of the user the message should be visible to
|
|
11
12
|
* @param text Text of the message
|
|
12
13
|
*/
|
|
13
|
-
export declare function sendEphemeralMessage(client: ITelegramClient, chatId: InputPeerLike, receiverId: InputPeerLike, text: InputText, params?: {
|
|
14
|
+
export declare function sendEphemeralMessage(client: ITelegramClient, chatId: InputPeerLike | null, receiverId: InputPeerLike, text: InputText, params?: {
|
|
14
15
|
/** Media to be attached to the message */
|
|
15
16
|
media?: InputMediaLike;
|
|
17
|
+
/** Rich message content to be sent instead of the plain text */
|
|
18
|
+
richMessage?: InputRichMessage;
|
|
16
19
|
/** Message to reply to */
|
|
17
20
|
replyTo?: number;
|
|
18
21
|
/** Ephemeral message to reply to */
|
|
@@ -21,6 +24,21 @@ export declare function sendEphemeralMessage(client: ITelegramClient, chatId: In
|
|
|
21
24
|
replyMarkup?: ReplyMarkup;
|
|
22
25
|
/** For guest chat bots, ID of the query that this message is sent in response to */
|
|
23
26
|
queryId?: tl.Long;
|
|
27
|
+
/** Whether to send this message as a welcome message template for the chat */
|
|
28
|
+
welcome?: boolean;
|
|
29
|
+
/** Whether to anchor this message to the message it replies to */
|
|
30
|
+
anchor?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to invert the media position.
|
|
33
|
+
*
|
|
34
|
+
* Currently only supported for web previews and makes the
|
|
35
|
+
* client render the preview above the caption and not below.
|
|
36
|
+
*/
|
|
37
|
+
invertMedia?: boolean;
|
|
38
|
+
/** Whether to forbid forwarding this message */
|
|
39
|
+
forbidForwards?: boolean;
|
|
40
|
+
/** Cache for the uploaded rich message media, see {@link createRichStreamingDraft} */
|
|
41
|
+
uploadCache?: RichMediaUploadCache;
|
|
24
42
|
/**
|
|
25
43
|
* Whether to dispatch the returned updates
|
|
26
44
|
* to the client's update handler.
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { MtArgumentError } from "../../../types/errors.js";
|
|
1
2
|
import { randomLong } from "../../../utils/long-utils.js";
|
|
2
3
|
import { _normalizeInputMedia } from "../files/normalize-input-media.js";
|
|
4
|
+
import { _normalizeInputRichMessage } from "../messages/normalize-rich-message.js";
|
|
3
5
|
import { _normalizeInputText } from "../misc/normalize-text.js";
|
|
4
6
|
import { resolvePeer, resolveUser } from "../users/resolve-peer.js";
|
|
5
7
|
import { _findEphemeralMessageInUpdate } from "./find-in-update.js";
|
|
6
8
|
import { _convertToTl } from "../../types/bots/keyboards/factories.js";
|
|
7
9
|
async function sendEphemeralMessage(client, chatId, receiverId, text, params) {
|
|
8
|
-
const { media, replyTo, replyToEphemeral, queryId, shouldDispatch } = params ?? {};
|
|
10
|
+
const { media, richMessage, replyTo, replyToEphemeral, queryId, shouldDispatch, uploadCache } = params ?? {};
|
|
9
11
|
const [message, entities] = await _normalizeInputText(client, text);
|
|
10
|
-
const peer = await resolvePeer(client, chatId);
|
|
12
|
+
const peer = chatId !== null ? await resolvePeer(client, chatId) : void 0;
|
|
13
|
+
if (richMessage && !peer) {
|
|
14
|
+
throw new MtArgumentError("richMessage requires chatId to be passed");
|
|
15
|
+
}
|
|
11
16
|
let replyToTl;
|
|
12
17
|
if (replyTo !== void 0) {
|
|
13
18
|
replyToTl = { _: "inputReplyToMessage", replyToMsgId: replyTo };
|
|
@@ -22,9 +27,14 @@ async function sendEphemeralMessage(client, chatId, receiverId, text, params) {
|
|
|
22
27
|
message,
|
|
23
28
|
entities,
|
|
24
29
|
media: media ? await _normalizeInputMedia(client, media, { uploadPeer: peer }) : void 0,
|
|
30
|
+
richMessage: richMessage ? await _normalizeInputRichMessage(client, peer, richMessage, { uploadCache }) : void 0,
|
|
25
31
|
replyMarkup: _convertToTl(params?.replyMarkup),
|
|
26
32
|
randomId: randomLong(),
|
|
27
|
-
replyTo: replyToTl
|
|
33
|
+
replyTo: replyToTl,
|
|
34
|
+
welcome: params?.welcome,
|
|
35
|
+
anchor: params?.anchor,
|
|
36
|
+
invertMedia: params?.invertMedia,
|
|
37
|
+
noforwards: params?.forbidForwards
|
|
28
38
|
});
|
|
29
39
|
return _findEphemeralMessageInUpdate(client, res, false, !shouldDispatch);
|
|
30
40
|
}
|
|
@@ -257,6 +257,9 @@ async function* downloadAsIterable(client, input, params) {
|
|
|
257
257
|
} finally {
|
|
258
258
|
if (stallTimer) utils.timers.clearTimeout(stallTimer);
|
|
259
259
|
abortSignal$1?.removeEventListener("abort", onAbort);
|
|
260
|
+
ended = true;
|
|
261
|
+
for (const idx in buffer) delete buffer[Number(idx)];
|
|
262
|
+
nextChunkCv.notify();
|
|
260
263
|
}
|
|
261
264
|
}
|
|
262
265
|
exports._normalizeFileDownloadLocation = _normalizeFileDownloadLocation;
|
|
@@ -250,6 +250,9 @@ async function* downloadAsIterable(client, input, params) {
|
|
|
250
250
|
} finally {
|
|
251
251
|
if (stallTimer) timers.clearTimeout(stallTimer);
|
|
252
252
|
abortSignal?.removeEventListener("abort", onAbort);
|
|
253
|
+
ended = true;
|
|
254
|
+
for (const idx in buffer) delete buffer[Number(idx)];
|
|
255
|
+
nextChunkCv.notify();
|
|
253
256
|
}
|
|
254
257
|
}
|
|
255
258
|
export {
|
|
@@ -7,6 +7,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const fileId = require("@mtcute/file-id");
|
|
9
9
|
const Long = require("long");
|
|
10
|
+
const errors = require("../../../types/errors.cjs");
|
|
10
11
|
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
11
12
|
const uploadedFile = require("../../types/files/uploaded-file.cjs");
|
|
12
13
|
const entities = require("../../types/misc/entities.cjs");
|
|
@@ -221,7 +222,7 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
221
222
|
title: entities.inputTextToTl(media.title),
|
|
222
223
|
list: media.items.map((it, idx) => ({
|
|
223
224
|
_: "todoItem",
|
|
224
|
-
id: idx,
|
|
225
|
+
id: idx + 1,
|
|
225
226
|
title: entities.inputTextToTl(it)
|
|
226
227
|
}))
|
|
227
228
|
}
|
|
@@ -250,11 +251,32 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
250
251
|
inputFile = uploaded.inputFile;
|
|
251
252
|
mime = uploaded.mime;
|
|
252
253
|
};
|
|
254
|
+
const uploadPeer = params.uploadPeer ?? { _: "inputPeerSelf" };
|
|
253
255
|
let videoCover;
|
|
254
256
|
if (media.type === "video" && media.cover) {
|
|
255
257
|
const inputMedia = await _normalizeInputMedia(client, media.cover, params);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
if (inputMedia._ !== "inputMediaPhoto" && inputMedia._ !== "inputMediaPhotoExternal" && inputMedia._ !== "inputMediaUploadedPhoto") {
|
|
259
|
+
throw new errors.MtArgumentError("media.cover must be a photo");
|
|
260
|
+
}
|
|
261
|
+
if (inputMedia._ === "inputMediaPhoto") {
|
|
262
|
+
videoCover = inputMedia.id;
|
|
263
|
+
} else {
|
|
264
|
+
const res = await client.call({
|
|
265
|
+
_: "messages.uploadMedia",
|
|
266
|
+
peer: uploadPeer,
|
|
267
|
+
media: inputMedia,
|
|
268
|
+
businessConnectionId: params.businessConnectionId
|
|
269
|
+
}, { abortSignal: params.abortSignal });
|
|
270
|
+
if (res._ !== "messageMediaPhoto" || res.photo?._ !== "photo") {
|
|
271
|
+
throw new errors.MtArgumentError("media.cover must be a photo");
|
|
272
|
+
}
|
|
273
|
+
videoCover = {
|
|
274
|
+
_: "inputPhoto",
|
|
275
|
+
id: res.photo.id,
|
|
276
|
+
accessHash: res.photo.accessHash,
|
|
277
|
+
fileReference: res.photo.fileReference
|
|
278
|
+
};
|
|
279
|
+
}
|
|
258
280
|
}
|
|
259
281
|
let livePhotoVideo;
|
|
260
282
|
if (media.type === "photo" && media.livePhotoVideo) {
|
|
@@ -262,7 +284,6 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
262
284
|
typeAssertions.assertTypeIs("uploadMediaIfNeeded", inputMedia, "inputMediaDocument");
|
|
263
285
|
livePhotoVideo = inputMedia.id;
|
|
264
286
|
}
|
|
265
|
-
const uploadPeer = params.uploadPeer ?? { _: "inputPeerSelf" };
|
|
266
287
|
const uploadMediaIfNeeded = async (inputMedia, photo) => {
|
|
267
288
|
if (!uploadMedia) return inputMedia;
|
|
268
289
|
const res = await client.call({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { tdFileId, parseFileId } from "@mtcute/file-id";
|
|
2
2
|
import Long from "long";
|
|
3
|
+
import { MtArgumentError } from "../../../types/errors.js";
|
|
3
4
|
import { assertTypeIs } from "../../../utils/type-assertions.js";
|
|
4
5
|
import { isUploadedFile } from "../../types/files/uploaded-file.js";
|
|
5
6
|
import { inputTextToTl } from "../../types/misc/entities.js";
|
|
@@ -214,7 +215,7 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
214
215
|
title: inputTextToTl(media.title),
|
|
215
216
|
list: media.items.map((it, idx) => ({
|
|
216
217
|
_: "todoItem",
|
|
217
|
-
id: idx,
|
|
218
|
+
id: idx + 1,
|
|
218
219
|
title: inputTextToTl(it)
|
|
219
220
|
}))
|
|
220
221
|
}
|
|
@@ -243,11 +244,32 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
243
244
|
inputFile = uploaded.inputFile;
|
|
244
245
|
mime = uploaded.mime;
|
|
245
246
|
};
|
|
247
|
+
const uploadPeer = params.uploadPeer ?? { _: "inputPeerSelf" };
|
|
246
248
|
let videoCover;
|
|
247
249
|
if (media.type === "video" && media.cover) {
|
|
248
250
|
const inputMedia = await _normalizeInputMedia(client, media.cover, params);
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
if (inputMedia._ !== "inputMediaPhoto" && inputMedia._ !== "inputMediaPhotoExternal" && inputMedia._ !== "inputMediaUploadedPhoto") {
|
|
252
|
+
throw new MtArgumentError("media.cover must be a photo");
|
|
253
|
+
}
|
|
254
|
+
if (inputMedia._ === "inputMediaPhoto") {
|
|
255
|
+
videoCover = inputMedia.id;
|
|
256
|
+
} else {
|
|
257
|
+
const res = await client.call({
|
|
258
|
+
_: "messages.uploadMedia",
|
|
259
|
+
peer: uploadPeer,
|
|
260
|
+
media: inputMedia,
|
|
261
|
+
businessConnectionId: params.businessConnectionId
|
|
262
|
+
}, { abortSignal: params.abortSignal });
|
|
263
|
+
if (res._ !== "messageMediaPhoto" || res.photo?._ !== "photo") {
|
|
264
|
+
throw new MtArgumentError("media.cover must be a photo");
|
|
265
|
+
}
|
|
266
|
+
videoCover = {
|
|
267
|
+
_: "inputPhoto",
|
|
268
|
+
id: res.photo.id,
|
|
269
|
+
accessHash: res.photo.accessHash,
|
|
270
|
+
fileReference: res.photo.fileReference
|
|
271
|
+
};
|
|
272
|
+
}
|
|
251
273
|
}
|
|
252
274
|
let livePhotoVideo;
|
|
253
275
|
if (media.type === "photo" && media.livePhotoVideo) {
|
|
@@ -255,7 +277,6 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
|
|
|
255
277
|
assertTypeIs("uploadMediaIfNeeded", inputMedia, "inputMediaDocument");
|
|
256
278
|
livePhotoVideo = inputMedia.id;
|
|
257
279
|
}
|
|
258
|
-
const uploadPeer = params.uploadPeer ?? { _: "inputPeerSelf" };
|
|
259
280
|
const uploadMediaIfNeeded = async (inputMedia, photo) => {
|
|
260
281
|
if (!uploadMedia) return inputMedia;
|
|
261
282
|
const res = await client.call({
|
|
@@ -19,6 +19,6 @@ async function editForumTopic(client, params) {
|
|
|
19
19
|
closed,
|
|
20
20
|
hidden
|
|
21
21
|
});
|
|
22
|
-
return findInUpdate._findMessageInUpdate(client, res, false, shouldDispatch);
|
|
22
|
+
return findInUpdate._findMessageInUpdate(client, res, false, !shouldDispatch);
|
|
23
23
|
}
|
|
24
24
|
exports.editForumTopic = editForumTopic;
|
|
@@ -15,6 +15,6 @@ async function toggleForumTopicClosed(client, parmas) {
|
|
|
15
15
|
topicId: typeof topicId === "number" ? topicId : topicId.id,
|
|
16
16
|
closed
|
|
17
17
|
});
|
|
18
|
-
return findInUpdate._findMessageInUpdate(client, res, false, shouldDispatch);
|
|
18
|
+
return findInUpdate._findMessageInUpdate(client, res, false, !shouldDispatch);
|
|
19
19
|
}
|
|
20
20
|
exports.toggleForumTopicClosed = toggleForumTopicClosed;
|
|
@@ -8,7 +8,7 @@ async function toggleForumTopicClosed(client, parmas) {
|
|
|
8
8
|
topicId: typeof topicId === "number" ? topicId : topicId.id,
|
|
9
9
|
closed
|
|
10
10
|
});
|
|
11
|
-
return _findMessageInUpdate(client, res, false, shouldDispatch);
|
|
11
|
+
return _findMessageInUpdate(client, res, false, !shouldDispatch);
|
|
12
12
|
}
|
|
13
13
|
export {
|
|
14
14
|
toggleForumTopicClosed
|
|
@@ -15,6 +15,6 @@ async function toggleGeneralTopicHidden(client, params) {
|
|
|
15
15
|
topicId: 1,
|
|
16
16
|
hidden
|
|
17
17
|
});
|
|
18
|
-
return findInUpdate._findMessageInUpdate(client, res, false, shouldDispatch);
|
|
18
|
+
return findInUpdate._findMessageInUpdate(client, res, false, !shouldDispatch);
|
|
19
19
|
}
|
|
20
20
|
exports.toggleGeneralTopicHidden = toggleGeneralTopicHidden;
|
|
@@ -8,7 +8,7 @@ async function toggleGeneralTopicHidden(client, params) {
|
|
|
8
8
|
topicId: 1,
|
|
9
9
|
hidden
|
|
10
10
|
});
|
|
11
|
-
return _findMessageInUpdate(client, res, false, shouldDispatch);
|
|
11
|
+
return _findMessageInUpdate(client, res, false, !shouldDispatch);
|
|
12
12
|
}
|
|
13
13
|
export {
|
|
14
14
|
toggleGeneralTopicHidden
|