@mtcute/core 0.24.1 → 0.24.2
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 +7 -0
- package/client.js +8 -1
- package/highlevel/client.d.cts +17 -0
- package/highlevel/client.d.ts +17 -0
- package/highlevel/methods/chats/get-message-author.cjs +20 -0
- package/highlevel/methods/chats/get-message-author.d.cts +3 -0
- package/highlevel/methods/chats/get-message-author.d.ts +3 -0
- package/highlevel/methods/chats/get-message-author.js +15 -0
- package/highlevel/methods/forums/toggle-forum.cjs +12 -1
- package/highlevel/methods/forums/toggle-forum.d.cts +14 -0
- package/highlevel/methods/forums/toggle-forum.d.ts +14 -0
- package/highlevel/methods/forums/toggle-forum.js +13 -2
- package/highlevel/methods/messages/forward-messages.cjs +9 -2
- package/highlevel/methods/messages/forward-messages.d.cts +7 -0
- package/highlevel/methods/messages/forward-messages.d.ts +7 -0
- package/highlevel/methods/messages/forward-messages.js +9 -2
- package/highlevel/methods/messages/send-common.cjs +7 -1
- package/highlevel/methods/messages/send-common.d.cts +7 -0
- package/highlevel/methods/messages/send-common.d.ts +7 -0
- package/highlevel/methods/messages/send-common.js +7 -1
- package/highlevel/methods.d.cts +2 -0
- package/highlevel/methods.d.ts +2 -0
- package/highlevel/types/media/input-media/factories.cjs +1 -0
- package/highlevel/types/media/input-media/factories.js +1 -0
- package/highlevel/types/messages/message-action.d.cts +2 -0
- package/highlevel/types/messages/message-action.d.ts +2 -0
- package/highlevel/types/peers/chat.cjs +19 -0
- package/highlevel/types/peers/chat.d.cts +13 -1
- package/highlevel/types/peers/chat.d.ts +13 -1
- package/highlevel/types/peers/chat.js +19 -0
- package/highlevel/types/peers/full-chat.cjs +10 -0
- package/highlevel/types/peers/full-chat.d.cts +6 -0
- package/highlevel/types/peers/full-chat.d.ts +6 -0
- package/highlevel/types/peers/full-chat.js +10 -0
- package/highlevel/types/peers/peer.d.cts +1 -1
- package/highlevel/types/peers/peer.d.ts +1 -1
- package/highlevel/types/updates/history-read-update.cjs +21 -0
- package/highlevel/types/updates/history-read-update.d.cts +7 -2
- package/highlevel/types/updates/history-read-update.d.ts +7 -2
- package/highlevel/types/updates/history-read-update.js +21 -0
- package/methods.cjs +3 -0
- package/methods.js +4 -1
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/package.json +2 -2
- package/utils/binary/compat.cjs +4 -0
- package/utils/binary/compat.js +4 -0
- package/utils/peer-utils.cjs +2 -8
- package/utils/peer-utils.js +3 -9
package/client.cjs
CHANGED
|
@@ -57,6 +57,7 @@ const getChatPreview = require("./highlevel/methods/chats/get-chat-preview.cjs")
|
|
|
57
57
|
const getChat = require("./highlevel/methods/chats/get-chat.cjs");
|
|
58
58
|
const getFullChat = require("./highlevel/methods/chats/get-full-chat.cjs");
|
|
59
59
|
const getFullUser = require("./highlevel/methods/chats/get-full-user.cjs");
|
|
60
|
+
const getMessageAuthor = require("./highlevel/methods/chats/get-message-author.cjs");
|
|
60
61
|
const getNearbyChats = require("./highlevel/methods/chats/get-nearby-chats.cjs");
|
|
61
62
|
const getPeer = require("./highlevel/methods/chats/get-peer.cjs");
|
|
62
63
|
const getSimilarChannels = require("./highlevel/methods/chats/get-similar-channels.cjs");
|
|
@@ -593,6 +594,9 @@ TelegramClient.prototype.getFullChat = function(...args) {
|
|
|
593
594
|
TelegramClient.prototype.getFullUser = function(...args) {
|
|
594
595
|
return getFullUser.getFullUser(this._client, ...args);
|
|
595
596
|
};
|
|
597
|
+
TelegramClient.prototype.getMessageAuthor = function(...args) {
|
|
598
|
+
return getMessageAuthor.getMessageAuthor(this._client, ...args);
|
|
599
|
+
};
|
|
596
600
|
TelegramClient.prototype.getNearbyChats = function(...args) {
|
|
597
601
|
return getNearbyChats.getNearbyChats(this._client, ...args);
|
|
598
602
|
};
|
|
@@ -779,6 +783,9 @@ TelegramClient.prototype.toggleForumTopicPinned = function(...args) {
|
|
|
779
783
|
TelegramClient.prototype.toggleForum = function(...args) {
|
|
780
784
|
return toggleForum.toggleForum(this._client, ...args);
|
|
781
785
|
};
|
|
786
|
+
TelegramClient.prototype.updateForumSettings = function(...args) {
|
|
787
|
+
return toggleForum.updateForumSettings(this._client, ...args);
|
|
788
|
+
};
|
|
782
789
|
TelegramClient.prototype.toggleGeneralTopicHidden = function(...args) {
|
|
783
790
|
return toggleGeneralTopicHidden.toggleGeneralTopicHidden(this._client, ...args);
|
|
784
791
|
};
|
package/client.js
CHANGED
|
@@ -50,6 +50,7 @@ import { getChatPreview } from "./highlevel/methods/chats/get-chat-preview.js";
|
|
|
50
50
|
import { getChat } from "./highlevel/methods/chats/get-chat.js";
|
|
51
51
|
import { getFullChat } from "./highlevel/methods/chats/get-full-chat.js";
|
|
52
52
|
import { getFullUser } from "./highlevel/methods/chats/get-full-user.js";
|
|
53
|
+
import { getMessageAuthor } from "./highlevel/methods/chats/get-message-author.js";
|
|
53
54
|
import { getNearbyChats } from "./highlevel/methods/chats/get-nearby-chats.js";
|
|
54
55
|
import { getPeer } from "./highlevel/methods/chats/get-peer.js";
|
|
55
56
|
import { getSimilarChannels } from "./highlevel/methods/chats/get-similar-channels.js";
|
|
@@ -109,7 +110,7 @@ import { iterForumTopics } from "./highlevel/methods/forums/iter-forum-topics.js
|
|
|
109
110
|
import { reorderPinnedForumTopics } from "./highlevel/methods/forums/reorder-pinned-forum-topics.js";
|
|
110
111
|
import { toggleForumTopicClosed } from "./highlevel/methods/forums/toggle-forum-topic-closed.js";
|
|
111
112
|
import { toggleForumTopicPinned } from "./highlevel/methods/forums/toggle-forum-topic-pinned.js";
|
|
112
|
-
import { toggleForum } from "./highlevel/methods/forums/toggle-forum.js";
|
|
113
|
+
import { toggleForum, updateForumSettings } from "./highlevel/methods/forums/toggle-forum.js";
|
|
113
114
|
import { toggleGeneralTopicHidden } from "./highlevel/methods/forums/toggle-general-topic-hidden.js";
|
|
114
115
|
import { createInviteLink } from "./highlevel/methods/invite-links/create-invite-link.js";
|
|
115
116
|
import { editInviteLink } from "./highlevel/methods/invite-links/edit-invite-link.js";
|
|
@@ -586,6 +587,9 @@ TelegramClient.prototype.getFullChat = function(...args) {
|
|
|
586
587
|
TelegramClient.prototype.getFullUser = function(...args) {
|
|
587
588
|
return getFullUser(this._client, ...args);
|
|
588
589
|
};
|
|
590
|
+
TelegramClient.prototype.getMessageAuthor = function(...args) {
|
|
591
|
+
return getMessageAuthor(this._client, ...args);
|
|
592
|
+
};
|
|
589
593
|
TelegramClient.prototype.getNearbyChats = function(...args) {
|
|
590
594
|
return getNearbyChats(this._client, ...args);
|
|
591
595
|
};
|
|
@@ -772,6 +776,9 @@ TelegramClient.prototype.toggleForumTopicPinned = function(...args) {
|
|
|
772
776
|
TelegramClient.prototype.toggleForum = function(...args) {
|
|
773
777
|
return toggleForum(this._client, ...args);
|
|
774
778
|
};
|
|
779
|
+
TelegramClient.prototype.updateForumSettings = function(...args) {
|
|
780
|
+
return updateForumSettings(this._client, ...args);
|
|
781
|
+
};
|
|
775
782
|
TelegramClient.prototype.toggleGeneralTopicHidden = function(...args) {
|
|
776
783
|
return toggleGeneralTopicHidden(this._client, ...args);
|
|
777
784
|
};
|
package/highlevel/client.d.cts
CHANGED
|
@@ -1290,6 +1290,7 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
1290
1290
|
* @param userId ID of the user or their username
|
|
1291
1291
|
*/
|
|
1292
1292
|
getFullUser(userId: InputPeerLike): Promise<FullUser>;
|
|
1293
|
+
getMessageAuthor(message: InputMessageId): Promise<User>;
|
|
1293
1294
|
/**
|
|
1294
1295
|
* Get nearby chats
|
|
1295
1296
|
*
|
|
@@ -2335,8 +2336,24 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
2335
2336
|
*
|
|
2336
2337
|
* @param chatId Chat ID or username
|
|
2337
2338
|
* @param [enabled=false] Whether the supergroup should be a forum
|
|
2339
|
+
* @deprecated Use {@link updateForumSettings} instead
|
|
2338
2340
|
*/
|
|
2339
2341
|
toggleForum(chatId: InputPeerLike, enabled?: boolean): Promise<void>;
|
|
2342
|
+
/**
|
|
2343
|
+
* Update forum settings of a supergroup.
|
|
2344
|
+
*
|
|
2345
|
+
* Only owner of the supergroup can change this setting.
|
|
2346
|
+
*
|
|
2347
|
+
* **Available**: 👤 users only
|
|
2348
|
+
*
|
|
2349
|
+
* @param chatId Chat ID or username
|
|
2350
|
+
* @param settings New settings. `null` is a shorthand for `{ isForum: false }`
|
|
2351
|
+
*/
|
|
2352
|
+
updateForumSettings(chatId: InputPeerLike, settings: null | {
|
|
2353
|
+
/** Whether the supergroup should be a forum */
|
|
2354
|
+
isForum: boolean;
|
|
2355
|
+
threadsMode: 'list' | 'tabs';
|
|
2356
|
+
}): Promise<void>;
|
|
2340
2357
|
/**
|
|
2341
2358
|
* Toggle whether "General" topic in a forum is hidden or not
|
|
2342
2359
|
*
|
package/highlevel/client.d.ts
CHANGED
|
@@ -1290,6 +1290,7 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
1290
1290
|
* @param userId ID of the user or their username
|
|
1291
1291
|
*/
|
|
1292
1292
|
getFullUser(userId: InputPeerLike): Promise<FullUser>;
|
|
1293
|
+
getMessageAuthor(message: InputMessageId): Promise<User>;
|
|
1293
1294
|
/**
|
|
1294
1295
|
* Get nearby chats
|
|
1295
1296
|
*
|
|
@@ -2335,8 +2336,24 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
2335
2336
|
*
|
|
2336
2337
|
* @param chatId Chat ID or username
|
|
2337
2338
|
* @param [enabled=false] Whether the supergroup should be a forum
|
|
2339
|
+
* @deprecated Use {@link updateForumSettings} instead
|
|
2338
2340
|
*/
|
|
2339
2341
|
toggleForum(chatId: InputPeerLike, enabled?: boolean): Promise<void>;
|
|
2342
|
+
/**
|
|
2343
|
+
* Update forum settings of a supergroup.
|
|
2344
|
+
*
|
|
2345
|
+
* Only owner of the supergroup can change this setting.
|
|
2346
|
+
*
|
|
2347
|
+
* **Available**: 👤 users only
|
|
2348
|
+
*
|
|
2349
|
+
* @param chatId Chat ID or username
|
|
2350
|
+
* @param settings New settings. `null` is a shorthand for `{ isForum: false }`
|
|
2351
|
+
*/
|
|
2352
|
+
updateForumSettings(chatId: InputPeerLike, settings: null | {
|
|
2353
|
+
/** Whether the supergroup should be a forum */
|
|
2354
|
+
isForum: boolean;
|
|
2355
|
+
threadsMode: 'list' | 'tabs';
|
|
2356
|
+
}): Promise<void>;
|
|
2340
2357
|
/**
|
|
2341
2358
|
* Toggle whether "General" topic in a forum is hidden or not
|
|
2342
2359
|
*
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS support is deprecated and will be removed in 0.25.0. 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 resolvePeer = require("../users/resolve-peer.cjs");
|
|
9
|
+
const inputMessageId = require("../../types/messages/input-message-id.cjs");
|
|
10
|
+
const user = require("../../types/peers/user.cjs");
|
|
11
|
+
async function getMessageAuthor(client, message) {
|
|
12
|
+
const { chatId, message: msgId } = inputMessageId.normalizeInputMessageId(message);
|
|
13
|
+
const res = await client.call({
|
|
14
|
+
_: "channels.getMessageAuthor",
|
|
15
|
+
channel: await resolvePeer.resolveChannel(client, chatId),
|
|
16
|
+
id: msgId
|
|
17
|
+
});
|
|
18
|
+
return new user.User(res);
|
|
19
|
+
}
|
|
20
|
+
exports.getMessageAuthor = getMessageAuthor;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { resolveChannel } from "../users/resolve-peer.js";
|
|
2
|
+
import { normalizeInputMessageId } from "../../types/messages/input-message-id.js";
|
|
3
|
+
import { User as User$2 } from "../../types/peers/user.js";
|
|
4
|
+
async function getMessageAuthor(client, message) {
|
|
5
|
+
const { chatId, message: msgId } = normalizeInputMessageId(message);
|
|
6
|
+
const res = await client.call({
|
|
7
|
+
_: "channels.getMessageAuthor",
|
|
8
|
+
channel: await resolveChannel(client, chatId),
|
|
9
|
+
id: msgId
|
|
10
|
+
});
|
|
11
|
+
return new User$2(res);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
getMessageAuthor
|
|
15
|
+
};
|
|
@@ -10,8 +10,19 @@ async function toggleForum(client, chatId, enabled = false) {
|
|
|
10
10
|
const res = await client.call({
|
|
11
11
|
_: "channels.toggleForum",
|
|
12
12
|
channel: await resolvePeer.resolveChannel(client, chatId),
|
|
13
|
-
enabled
|
|
13
|
+
enabled,
|
|
14
|
+
tabs: false
|
|
15
|
+
});
|
|
16
|
+
client.handleClientUpdate(res);
|
|
17
|
+
}
|
|
18
|
+
async function updateForumSettings(client, chatId, settings) {
|
|
19
|
+
const res = await client.call({
|
|
20
|
+
_: "channels.toggleForum",
|
|
21
|
+
channel: await resolvePeer.resolveChannel(client, chatId),
|
|
22
|
+
enabled: settings?.isForum ?? false,
|
|
23
|
+
tabs: settings?.threadsMode === "tabs"
|
|
14
24
|
});
|
|
15
25
|
client.handleClientUpdate(res);
|
|
16
26
|
}
|
|
17
27
|
exports.toggleForum = toggleForum;
|
|
28
|
+
exports.updateForumSettings = updateForumSettings;
|
|
@@ -7,5 +7,19 @@ import { InputPeerLike } from '../../types/index.js';
|
|
|
7
7
|
*
|
|
8
8
|
* @param chatId Chat ID or username
|
|
9
9
|
* @param enabled Whether the supergroup should be a forum
|
|
10
|
+
* @deprecated Use {@link updateForumSettings} instead
|
|
10
11
|
*/
|
|
11
12
|
export declare function toggleForum(client: ITelegramClient, chatId: InputPeerLike, enabled?: boolean): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Update forum settings of a supergroup.
|
|
15
|
+
*
|
|
16
|
+
* Only owner of the supergroup can change this setting.
|
|
17
|
+
*
|
|
18
|
+
* @param chatId Chat ID or username
|
|
19
|
+
* @param settings New settings. `null` is a shorthand for `{ isForum: false }`
|
|
20
|
+
*/
|
|
21
|
+
export declare function updateForumSettings(client: ITelegramClient, chatId: InputPeerLike, settings: null | {
|
|
22
|
+
/** Whether the supergroup should be a forum */
|
|
23
|
+
isForum: boolean;
|
|
24
|
+
threadsMode: 'list' | 'tabs';
|
|
25
|
+
}): Promise<void>;
|
|
@@ -7,5 +7,19 @@ import { InputPeerLike } from '../../types/index.js';
|
|
|
7
7
|
*
|
|
8
8
|
* @param chatId Chat ID or username
|
|
9
9
|
* @param enabled Whether the supergroup should be a forum
|
|
10
|
+
* @deprecated Use {@link updateForumSettings} instead
|
|
10
11
|
*/
|
|
11
12
|
export declare function toggleForum(client: ITelegramClient, chatId: InputPeerLike, enabled?: boolean): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Update forum settings of a supergroup.
|
|
15
|
+
*
|
|
16
|
+
* Only owner of the supergroup can change this setting.
|
|
17
|
+
*
|
|
18
|
+
* @param chatId Chat ID or username
|
|
19
|
+
* @param settings New settings. `null` is a shorthand for `{ isForum: false }`
|
|
20
|
+
*/
|
|
21
|
+
export declare function updateForumSettings(client: ITelegramClient, chatId: InputPeerLike, settings: null | {
|
|
22
|
+
/** Whether the supergroup should be a forum */
|
|
23
|
+
isForum: boolean;
|
|
24
|
+
threadsMode: 'list' | 'tabs';
|
|
25
|
+
}): Promise<void>;
|
|
@@ -3,10 +3,21 @@ async function toggleForum(client, chatId, enabled = false) {
|
|
|
3
3
|
const res = await client.call({
|
|
4
4
|
_: "channels.toggleForum",
|
|
5
5
|
channel: await resolveChannel(client, chatId),
|
|
6
|
-
enabled
|
|
6
|
+
enabled,
|
|
7
|
+
tabs: false
|
|
8
|
+
});
|
|
9
|
+
client.handleClientUpdate(res);
|
|
10
|
+
}
|
|
11
|
+
async function updateForumSettings(client, chatId, settings) {
|
|
12
|
+
const res = await client.call({
|
|
13
|
+
_: "channels.toggleForum",
|
|
14
|
+
channel: await resolveChannel(client, chatId),
|
|
15
|
+
enabled: settings?.isForum ?? false,
|
|
16
|
+
tabs: settings?.threadsMode === "tabs"
|
|
7
17
|
});
|
|
8
18
|
client.handleClientUpdate(res);
|
|
9
19
|
}
|
|
10
20
|
export {
|
|
11
|
-
toggleForum
|
|
21
|
+
toggleForum,
|
|
22
|
+
updateForumSettings
|
|
12
23
|
};
|
|
@@ -26,7 +26,9 @@ async function forwardMessagesById(client, params) {
|
|
|
26
26
|
noAuthor,
|
|
27
27
|
noCaption,
|
|
28
28
|
allowPaidFloodskip,
|
|
29
|
-
videoTimestamp
|
|
29
|
+
videoTimestamp,
|
|
30
|
+
toThreadId,
|
|
31
|
+
toMonoforumPeer
|
|
30
32
|
} = params;
|
|
31
33
|
if (messages.length > 100) {
|
|
32
34
|
throw new errors.MtArgumentError("You can forward no more than 100 messages at once");
|
|
@@ -48,7 +50,12 @@ async function forwardMessagesById(client, params) {
|
|
|
48
50
|
quickReplyShortcut: sendCommon._normalizeQuickReplyShortcut(params.quickReply),
|
|
49
51
|
allowPaidFloodskip,
|
|
50
52
|
videoTimestamp,
|
|
51
|
-
allowPaidStars: params.allowPaidMessages
|
|
53
|
+
allowPaidStars: params.allowPaidMessages,
|
|
54
|
+
topMsgId: toThreadId,
|
|
55
|
+
replyTo: toMonoforumPeer ? {
|
|
56
|
+
_: "inputReplyToMonoForum",
|
|
57
|
+
monoforumPeerId: await resolvePeer.resolvePeer(client, toMonoforumPeer)
|
|
58
|
+
} : void 0
|
|
52
59
|
});
|
|
53
60
|
utils.assertIsUpdatesGroup("messages.forwardMessages", res);
|
|
54
61
|
client.handleClientUpdate(res, !params.shouldDispatch);
|
|
@@ -4,6 +4,13 @@ import { InputPeerLike, Message } from '../../types/index.js';
|
|
|
4
4
|
export interface ForwardMessageOptions {
|
|
5
5
|
/** Destination chat ID, username, phone, `"me"` or `"self"` */
|
|
6
6
|
toChatId: InputPeerLike;
|
|
7
|
+
/** When forwarding to forums, ID of the thread to forward to */
|
|
8
|
+
toThreadId?: number;
|
|
9
|
+
/**
|
|
10
|
+
* When forwarding to a monoforum you are an admin of,
|
|
11
|
+
* you **must** pass an ID of a peer you are sending the message to.
|
|
12
|
+
*/
|
|
13
|
+
toMonoforumPeer?: InputPeerLike;
|
|
7
14
|
/**
|
|
8
15
|
* Whether to forward silently (also applies to caption message).
|
|
9
16
|
*/
|
|
@@ -4,6 +4,13 @@ import { InputPeerLike, Message } from '../../types/index.js';
|
|
|
4
4
|
export interface ForwardMessageOptions {
|
|
5
5
|
/** Destination chat ID, username, phone, `"me"` or `"self"` */
|
|
6
6
|
toChatId: InputPeerLike;
|
|
7
|
+
/** When forwarding to forums, ID of the thread to forward to */
|
|
8
|
+
toThreadId?: number;
|
|
9
|
+
/**
|
|
10
|
+
* When forwarding to a monoforum you are an admin of,
|
|
11
|
+
* you **must** pass an ID of a peer you are sending the message to.
|
|
12
|
+
*/
|
|
13
|
+
toMonoforumPeer?: InputPeerLike;
|
|
7
14
|
/**
|
|
8
15
|
* Whether to forward silently (also applies to caption message).
|
|
9
16
|
*/
|
|
@@ -19,7 +19,9 @@ async function forwardMessagesById(client, params) {
|
|
|
19
19
|
noAuthor,
|
|
20
20
|
noCaption,
|
|
21
21
|
allowPaidFloodskip,
|
|
22
|
-
videoTimestamp
|
|
22
|
+
videoTimestamp,
|
|
23
|
+
toThreadId,
|
|
24
|
+
toMonoforumPeer
|
|
23
25
|
} = params;
|
|
24
26
|
if (messages.length > 100) {
|
|
25
27
|
throw new MtArgumentError("You can forward no more than 100 messages at once");
|
|
@@ -41,7 +43,12 @@ async function forwardMessagesById(client, params) {
|
|
|
41
43
|
quickReplyShortcut: _normalizeQuickReplyShortcut(params.quickReply),
|
|
42
44
|
allowPaidFloodskip,
|
|
43
45
|
videoTimestamp,
|
|
44
|
-
allowPaidStars: params.allowPaidMessages
|
|
46
|
+
allowPaidStars: params.allowPaidMessages,
|
|
47
|
+
topMsgId: toThreadId,
|
|
48
|
+
replyTo: toMonoforumPeer ? {
|
|
49
|
+
_: "inputReplyToMonoForum",
|
|
50
|
+
monoforumPeerId: await resolvePeer(client, toMonoforumPeer)
|
|
51
|
+
} : void 0
|
|
45
52
|
});
|
|
46
53
|
assertIsUpdatesGroup("messages.forwardMessages", res);
|
|
47
54
|
client.handleClientUpdate(res, !params.shouldDispatch);
|
|
@@ -55,7 +55,13 @@ async function _processCommonSendParameters(client, chatId, params) {
|
|
|
55
55
|
replyToPeerId: replyToPeer,
|
|
56
56
|
quoteText: params.quote?.text,
|
|
57
57
|
quoteEntities: params.quote?.entities,
|
|
58
|
-
quoteOffset: params.quoteOffset
|
|
58
|
+
quoteOffset: params.quoteOffset,
|
|
59
|
+
monoforumPeerId: params.toMonoforumPeer ? await resolvePeer.resolvePeer(client, params.toMonoforumPeer) : void 0
|
|
60
|
+
};
|
|
61
|
+
} else if (params.toMonoforumPeer) {
|
|
62
|
+
tlReplyTo = {
|
|
63
|
+
_: "inputReplyToMonoForum",
|
|
64
|
+
monoforumPeerId: await resolvePeer.resolvePeer(client, params.toMonoforumPeer)
|
|
59
65
|
};
|
|
60
66
|
} else if (params.replyToStory) {
|
|
61
67
|
tlReplyTo = {
|
|
@@ -12,6 +12,13 @@ export interface CommonSendParams {
|
|
|
12
12
|
* Can also be a message from another chat, in which case a quote will be sent.
|
|
13
13
|
*/
|
|
14
14
|
replyTo?: number | Message;
|
|
15
|
+
/**
|
|
16
|
+
* When the chat is a monoforum you are an admin of, you **must** pass an
|
|
17
|
+
* ID of a peer you are sending the message to.
|
|
18
|
+
*
|
|
19
|
+
* Otherwise, you will get a `REPLY_TO_MONOFORUM_PEER_INVALID` error.
|
|
20
|
+
*/
|
|
21
|
+
toMonoforumPeer?: InputPeerLike;
|
|
15
22
|
/**
|
|
16
23
|
* Whether to throw an error if {@link replyTo}
|
|
17
24
|
* message does not exist.
|
|
@@ -12,6 +12,13 @@ export interface CommonSendParams {
|
|
|
12
12
|
* Can also be a message from another chat, in which case a quote will be sent.
|
|
13
13
|
*/
|
|
14
14
|
replyTo?: number | Message;
|
|
15
|
+
/**
|
|
16
|
+
* When the chat is a monoforum you are an admin of, you **must** pass an
|
|
17
|
+
* ID of a peer you are sending the message to.
|
|
18
|
+
*
|
|
19
|
+
* Otherwise, you will get a `REPLY_TO_MONOFORUM_PEER_INVALID` error.
|
|
20
|
+
*/
|
|
21
|
+
toMonoforumPeer?: InputPeerLike;
|
|
15
22
|
/**
|
|
16
23
|
* Whether to throw an error if {@link replyTo}
|
|
17
24
|
* message does not exist.
|
|
@@ -48,7 +48,13 @@ async function _processCommonSendParameters(client, chatId, params) {
|
|
|
48
48
|
replyToPeerId: replyToPeer,
|
|
49
49
|
quoteText: params.quote?.text,
|
|
50
50
|
quoteEntities: params.quote?.entities,
|
|
51
|
-
quoteOffset: params.quoteOffset
|
|
51
|
+
quoteOffset: params.quoteOffset,
|
|
52
|
+
monoforumPeerId: params.toMonoforumPeer ? await resolvePeer(client, params.toMonoforumPeer) : void 0
|
|
53
|
+
};
|
|
54
|
+
} else if (params.toMonoforumPeer) {
|
|
55
|
+
tlReplyTo = {
|
|
56
|
+
_: "inputReplyToMonoForum",
|
|
57
|
+
monoforumPeerId: await resolvePeer(client, params.toMonoforumPeer)
|
|
52
58
|
};
|
|
53
59
|
} else if (params.replyToStory) {
|
|
54
60
|
tlReplyTo = {
|
package/highlevel/methods.d.cts
CHANGED
|
@@ -53,6 +53,7 @@ export { getChatPreview } from './methods/chats/get-chat-preview.js';
|
|
|
53
53
|
export { getChat } from './methods/chats/get-chat.js';
|
|
54
54
|
export { getFullChat } from './methods/chats/get-full-chat.js';
|
|
55
55
|
export { getFullUser } from './methods/chats/get-full-user.js';
|
|
56
|
+
export { getMessageAuthor } from './methods/chats/get-message-author.js';
|
|
56
57
|
export { getNearbyChats } from './methods/chats/get-nearby-chats.js';
|
|
57
58
|
export { getPeer } from './methods/chats/get-peer.js';
|
|
58
59
|
export { getSimilarChannels } from './methods/chats/get-similar-channels.js';
|
|
@@ -115,6 +116,7 @@ export { reorderPinnedForumTopics } from './methods/forums/reorder-pinned-forum-
|
|
|
115
116
|
export { toggleForumTopicClosed } from './methods/forums/toggle-forum-topic-closed.js';
|
|
116
117
|
export { toggleForumTopicPinned } from './methods/forums/toggle-forum-topic-pinned.js';
|
|
117
118
|
export { toggleForum } from './methods/forums/toggle-forum.js';
|
|
119
|
+
export { updateForumSettings } from './methods/forums/toggle-forum.js';
|
|
118
120
|
export { toggleGeneralTopicHidden } from './methods/forums/toggle-general-topic-hidden.js';
|
|
119
121
|
export { createInviteLink } from './methods/invite-links/create-invite-link.js';
|
|
120
122
|
export { editInviteLink } from './methods/invite-links/edit-invite-link.js';
|
package/highlevel/methods.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export { getChatPreview } from './methods/chats/get-chat-preview.js';
|
|
|
53
53
|
export { getChat } from './methods/chats/get-chat.js';
|
|
54
54
|
export { getFullChat } from './methods/chats/get-full-chat.js';
|
|
55
55
|
export { getFullUser } from './methods/chats/get-full-user.js';
|
|
56
|
+
export { getMessageAuthor } from './methods/chats/get-message-author.js';
|
|
56
57
|
export { getNearbyChats } from './methods/chats/get-nearby-chats.js';
|
|
57
58
|
export { getPeer } from './methods/chats/get-peer.js';
|
|
58
59
|
export { getSimilarChannels } from './methods/chats/get-similar-channels.js';
|
|
@@ -115,6 +116,7 @@ export { reorderPinnedForumTopics } from './methods/forums/reorder-pinned-forum-
|
|
|
115
116
|
export { toggleForumTopicClosed } from './methods/forums/toggle-forum-topic-closed.js';
|
|
116
117
|
export { toggleForumTopicPinned } from './methods/forums/toggle-forum-topic-pinned.js';
|
|
117
118
|
export { toggleForum } from './methods/forums/toggle-forum.js';
|
|
119
|
+
export { updateForumSettings } from './methods/forums/toggle-forum.js';
|
|
118
120
|
export { toggleGeneralTopicHidden } from './methods/forums/toggle-general-topic-hidden.js';
|
|
119
121
|
export { createInviteLink } from './methods/invite-links/create-invite-link.js';
|
|
120
122
|
export { editInviteLink } from './methods/invite-links/edit-invite-link.js';
|
|
@@ -441,6 +441,8 @@ export interface ActionPaidMessagesPaid {
|
|
|
441
441
|
readonly type: 'messages_paid';
|
|
442
442
|
/** Amount of Telegram Stars paid */
|
|
443
443
|
stars: tl.Long;
|
|
444
|
+
/** Whether the stars were paid for a direct message to channel administrators */
|
|
445
|
+
broadcastDirect?: boolean;
|
|
444
446
|
}
|
|
445
447
|
/** Paid messages were refunded */
|
|
446
448
|
export interface ActionPaidMessagesRefunded {
|
|
@@ -441,6 +441,8 @@ export interface ActionPaidMessagesPaid {
|
|
|
441
441
|
readonly type: 'messages_paid';
|
|
442
442
|
/** Amount of Telegram Stars paid */
|
|
443
443
|
stars: tl.Long;
|
|
444
|
+
/** Whether the stars were paid for a direct message to channel administrators */
|
|
445
|
+
broadcastDirect?: boolean;
|
|
444
446
|
}
|
|
445
447
|
/** Paid messages were refunded */
|
|
446
448
|
export interface ActionPaidMessagesRefunded {
|
|
@@ -108,6 +108,8 @@ class Chat {
|
|
|
108
108
|
case "channelForbidden":
|
|
109
109
|
if (this.raw._ === "channel" && this.raw.gigagroup) {
|
|
110
110
|
return "gigagroup";
|
|
111
|
+
} else if (this.raw._ === "channel" && this.raw.monoforum) {
|
|
112
|
+
return "monoforum";
|
|
111
113
|
} else if (this.raw.broadcast) {
|
|
112
114
|
return "channel";
|
|
113
115
|
} else if (this.raw.megagroup) {
|
|
@@ -242,6 +244,23 @@ class Chat {
|
|
|
242
244
|
get hasAutoTranslation() {
|
|
243
245
|
return this.raw._ === "channel" && this.raw.autotranslation;
|
|
244
246
|
}
|
|
247
|
+
/** Whether this forum should display threads as tabs instead of a list */
|
|
248
|
+
get hasForumTabs() {
|
|
249
|
+
return this.raw._ === "channel" && this.raw.forumTabs;
|
|
250
|
+
}
|
|
251
|
+
/** Whether this broadcast channel has direct messages to channel administrators enabled */
|
|
252
|
+
get hasBroadcastDirect() {
|
|
253
|
+
return this.raw._ === "channel" && this.raw.broadcastMessagesAllowed;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Depending on {@link chatType}:
|
|
257
|
+
* - `channel`: this field might contain the ID of the linked monoforum,
|
|
258
|
+
* if this broadcast channel has a linked monoforum
|
|
259
|
+
* - `monoforum`: this field contains the ID of the channel that this monoforum is linked to
|
|
260
|
+
*/
|
|
261
|
+
get monoforumLinkedChatId() {
|
|
262
|
+
return this.raw._ === "channel" ? this.raw.linkedMonoforumId ?? null : null;
|
|
263
|
+
}
|
|
245
264
|
/** Chat title */
|
|
246
265
|
get title() {
|
|
247
266
|
return this.raw.title;
|
|
@@ -10,8 +10,9 @@ import { ChatPhoto } from './chat-photo.js';
|
|
|
10
10
|
* - `supergroup`: Supergroup
|
|
11
11
|
* - `channel`: Broadcast channel
|
|
12
12
|
* - `gigagroup`: Gigagroup aka Broadcast group
|
|
13
|
+
* - `monoforum`: Monoforum (chat for direct messages to channel administrators)
|
|
13
14
|
*/
|
|
14
|
-
export type ChatType = 'group' | 'supergroup' | 'channel' | 'gigagroup';
|
|
15
|
+
export type ChatType = 'group' | 'supergroup' | 'channel' | 'gigagroup' | 'monoforum';
|
|
15
16
|
/**
|
|
16
17
|
* A chat.
|
|
17
18
|
*/
|
|
@@ -131,6 +132,17 @@ export declare class Chat {
|
|
|
131
132
|
get hasSignatures(): boolean;
|
|
132
133
|
/** Whether this chat/channel has auto-translation enabled */
|
|
133
134
|
get hasAutoTranslation(): boolean;
|
|
135
|
+
/** Whether this forum should display threads as tabs instead of a list */
|
|
136
|
+
get hasForumTabs(): boolean;
|
|
137
|
+
/** Whether this broadcast channel has direct messages to channel administrators enabled */
|
|
138
|
+
get hasBroadcastDirect(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Depending on {@link chatType}:
|
|
141
|
+
* - `channel`: this field might contain the ID of the linked monoforum,
|
|
142
|
+
* if this broadcast channel has a linked monoforum
|
|
143
|
+
* - `monoforum`: this field contains the ID of the channel that this monoforum is linked to
|
|
144
|
+
*/
|
|
145
|
+
get monoforumLinkedChatId(): number | null;
|
|
134
146
|
/** Chat title */
|
|
135
147
|
get title(): string;
|
|
136
148
|
/** Chat username (if available) */
|
|
@@ -10,8 +10,9 @@ import { ChatPhoto } from './chat-photo.js';
|
|
|
10
10
|
* - `supergroup`: Supergroup
|
|
11
11
|
* - `channel`: Broadcast channel
|
|
12
12
|
* - `gigagroup`: Gigagroup aka Broadcast group
|
|
13
|
+
* - `monoforum`: Monoforum (chat for direct messages to channel administrators)
|
|
13
14
|
*/
|
|
14
|
-
export type ChatType = 'group' | 'supergroup' | 'channel' | 'gigagroup';
|
|
15
|
+
export type ChatType = 'group' | 'supergroup' | 'channel' | 'gigagroup' | 'monoforum';
|
|
15
16
|
/**
|
|
16
17
|
* A chat.
|
|
17
18
|
*/
|
|
@@ -131,6 +132,17 @@ export declare class Chat {
|
|
|
131
132
|
get hasSignatures(): boolean;
|
|
132
133
|
/** Whether this chat/channel has auto-translation enabled */
|
|
133
134
|
get hasAutoTranslation(): boolean;
|
|
135
|
+
/** Whether this forum should display threads as tabs instead of a list */
|
|
136
|
+
get hasForumTabs(): boolean;
|
|
137
|
+
/** Whether this broadcast channel has direct messages to channel administrators enabled */
|
|
138
|
+
get hasBroadcastDirect(): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Depending on {@link chatType}:
|
|
141
|
+
* - `channel`: this field might contain the ID of the linked monoforum,
|
|
142
|
+
* if this broadcast channel has a linked monoforum
|
|
143
|
+
* - `monoforum`: this field contains the ID of the channel that this monoforum is linked to
|
|
144
|
+
*/
|
|
145
|
+
get monoforumLinkedChatId(): number | null;
|
|
134
146
|
/** Chat title */
|
|
135
147
|
get title(): string;
|
|
136
148
|
/** Chat username (if available) */
|
|
@@ -101,6 +101,8 @@ class Chat {
|
|
|
101
101
|
case "channelForbidden":
|
|
102
102
|
if (this.raw._ === "channel" && this.raw.gigagroup) {
|
|
103
103
|
return "gigagroup";
|
|
104
|
+
} else if (this.raw._ === "channel" && this.raw.monoforum) {
|
|
105
|
+
return "monoforum";
|
|
104
106
|
} else if (this.raw.broadcast) {
|
|
105
107
|
return "channel";
|
|
106
108
|
} else if (this.raw.megagroup) {
|
|
@@ -235,6 +237,23 @@ class Chat {
|
|
|
235
237
|
get hasAutoTranslation() {
|
|
236
238
|
return this.raw._ === "channel" && this.raw.autotranslation;
|
|
237
239
|
}
|
|
240
|
+
/** Whether this forum should display threads as tabs instead of a list */
|
|
241
|
+
get hasForumTabs() {
|
|
242
|
+
return this.raw._ === "channel" && this.raw.forumTabs;
|
|
243
|
+
}
|
|
244
|
+
/** Whether this broadcast channel has direct messages to channel administrators enabled */
|
|
245
|
+
get hasBroadcastDirect() {
|
|
246
|
+
return this.raw._ === "channel" && this.raw.broadcastMessagesAllowed;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Depending on {@link chatType}:
|
|
250
|
+
* - `channel`: this field might contain the ID of the linked monoforum,
|
|
251
|
+
* if this broadcast channel has a linked monoforum
|
|
252
|
+
* - `monoforum`: this field contains the ID of the channel that this monoforum is linked to
|
|
253
|
+
*/
|
|
254
|
+
get monoforumLinkedChatId() {
|
|
255
|
+
return this.raw._ === "channel" ? this.raw.linkedMonoforumId ?? null : null;
|
|
256
|
+
}
|
|
238
257
|
/** Chat title */
|
|
239
258
|
get title() {
|
|
240
259
|
return this.raw.title;
|
|
@@ -253,6 +253,16 @@ class FullChat extends chat.Chat {
|
|
|
253
253
|
if (!this.full.linkedChatId) return null;
|
|
254
254
|
return new chat.Chat(this.peers.chat(this.full.linkedChatId));
|
|
255
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Information about a linked monoforum chat:
|
|
258
|
+
* - for channels: the linked monoforum
|
|
259
|
+
* - for monoforums: the channel this monoforum is linked to
|
|
260
|
+
*/
|
|
261
|
+
get monoforumLinkedChat() {
|
|
262
|
+
if (this.raw._ !== "channel") return null;
|
|
263
|
+
if (!this.raw.linkedMonoforumId) return null;
|
|
264
|
+
return new chat.Chat(this.peers.chat(this.raw.linkedMonoforumId));
|
|
265
|
+
}
|
|
256
266
|
/**
|
|
257
267
|
* TTL of all messages in this chat, in seconds
|
|
258
268
|
*/
|
|
@@ -138,6 +138,12 @@ export declare class FullChat extends Chat {
|
|
|
138
138
|
* - for supergroups: the linked channel
|
|
139
139
|
*/
|
|
140
140
|
get linkedChat(): Chat | null;
|
|
141
|
+
/**
|
|
142
|
+
* Information about a linked monoforum chat:
|
|
143
|
+
* - for channels: the linked monoforum
|
|
144
|
+
* - for monoforums: the channel this monoforum is linked to
|
|
145
|
+
*/
|
|
146
|
+
get monoforumLinkedChat(): Chat | null;
|
|
141
147
|
/**
|
|
142
148
|
* TTL of all messages in this chat, in seconds
|
|
143
149
|
*/
|
|
@@ -138,6 +138,12 @@ export declare class FullChat extends Chat {
|
|
|
138
138
|
* - for supergroups: the linked channel
|
|
139
139
|
*/
|
|
140
140
|
get linkedChat(): Chat | null;
|
|
141
|
+
/**
|
|
142
|
+
* Information about a linked monoforum chat:
|
|
143
|
+
* - for channels: the linked monoforum
|
|
144
|
+
* - for monoforums: the channel this monoforum is linked to
|
|
145
|
+
*/
|
|
146
|
+
get monoforumLinkedChat(): Chat | null;
|
|
141
147
|
/**
|
|
142
148
|
* TTL of all messages in this chat, in seconds
|
|
143
149
|
*/
|
|
@@ -246,6 +246,16 @@ class FullChat extends Chat$2 {
|
|
|
246
246
|
if (!this.full.linkedChatId) return null;
|
|
247
247
|
return new Chat$2(this.peers.chat(this.full.linkedChatId));
|
|
248
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Information about a linked monoforum chat:
|
|
251
|
+
* - for channels: the linked monoforum
|
|
252
|
+
* - for monoforums: the channel this monoforum is linked to
|
|
253
|
+
*/
|
|
254
|
+
get monoforumLinkedChat() {
|
|
255
|
+
if (this.raw._ !== "channel") return null;
|
|
256
|
+
if (!this.raw.linkedMonoforumId) return null;
|
|
257
|
+
return new Chat$2(this.peers.chat(this.raw.linkedMonoforumId));
|
|
258
|
+
}
|
|
249
259
|
/**
|
|
250
260
|
* TTL of all messages in this chat, in seconds
|
|
251
261
|
*/
|
|
@@ -18,7 +18,7 @@ export type PeerType = 'user' | 'bot' | 'group' | 'channel' | 'supergroup';
|
|
|
18
18
|
* > * Telegram has moved to int64 IDs. Though, Levin [has confirmed](https://t.me/tdlibchat/25071)
|
|
19
19
|
* > that new IDs *will* still fit into int53, meaning JS integers are fine.
|
|
20
20
|
*/
|
|
21
|
-
export type InputPeerLike = 'me' | 'self' | (string & {}) | number | tl.TypePeer | tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel | {
|
|
21
|
+
export type InputPeerLike = 'me' | 'self' | 'some_username' | (string & {}) | number | tl.TypePeer | tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel | {
|
|
22
22
|
inputPeer: tl.TypeInputPeer;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
@@ -18,7 +18,7 @@ export type PeerType = 'user' | 'bot' | 'group' | 'channel' | 'supergroup';
|
|
|
18
18
|
* > * Telegram has moved to int64 IDs. Though, Levin [has confirmed](https://t.me/tdlibchat/25071)
|
|
19
19
|
* > that new IDs *will* still fit into int53, meaning JS integers are fine.
|
|
20
20
|
*/
|
|
21
|
-
export type InputPeerLike = 'me' | 'self' | (string & {}) | number | tl.TypePeer | tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel | {
|
|
21
|
+
export type InputPeerLike = 'me' | 'self' | 'some_username' | (string & {}) | number | tl.TypePeer | tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel | {
|
|
22
22
|
inputPeer: tl.TypeInputPeer;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
@@ -38,6 +38,19 @@ class HistoryReadUpdate {
|
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Whether this update is about messages in a "monoforum"
|
|
43
|
+
* (i.e. a chat used for "direct channel messages")
|
|
44
|
+
*/
|
|
45
|
+
get isMonoForum() {
|
|
46
|
+
switch (this.raw._) {
|
|
47
|
+
case "updateReadMonoForumOutbox":
|
|
48
|
+
case "updateReadMonoForumInbox":
|
|
49
|
+
return true;
|
|
50
|
+
default:
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
41
54
|
/**
|
|
42
55
|
* Marked peer ID of the chat where the messages were read.
|
|
43
56
|
*/
|
|
@@ -50,6 +63,8 @@ class HistoryReadUpdate {
|
|
|
50
63
|
case "updateReadChannelInbox":
|
|
51
64
|
case "updateReadChannelDiscussionOutbox":
|
|
52
65
|
case "updateReadChannelDiscussionInbox":
|
|
66
|
+
case "updateReadMonoForumOutbox":
|
|
67
|
+
case "updateReadMonoForumInbox":
|
|
53
68
|
return peerUtils.toggleChannelIdMark(this.raw.channelId);
|
|
54
69
|
}
|
|
55
70
|
}
|
|
@@ -69,6 +84,8 @@ class HistoryReadUpdate {
|
|
|
69
84
|
case "updateReadHistoryOutbox":
|
|
70
85
|
case "updateReadChannelOutbox":
|
|
71
86
|
case "updateReadChannelDiscussionOutbox":
|
|
87
|
+
case "updateReadMonoForumOutbox":
|
|
88
|
+
case "updateReadMonoForumInbox":
|
|
72
89
|
return 0;
|
|
73
90
|
}
|
|
74
91
|
}
|
|
@@ -87,6 +104,8 @@ class HistoryReadUpdate {
|
|
|
87
104
|
return this.raw.maxId;
|
|
88
105
|
case "updateReadChannelDiscussionOutbox":
|
|
89
106
|
case "updateReadChannelDiscussionInbox":
|
|
107
|
+
case "updateReadMonoForumInbox":
|
|
108
|
+
case "updateReadMonoForumOutbox":
|
|
90
109
|
return this.raw.readMaxId;
|
|
91
110
|
}
|
|
92
111
|
}
|
|
@@ -101,6 +120,8 @@ class HistoryReadUpdate {
|
|
|
101
120
|
case "updateReadHistoryInbox":
|
|
102
121
|
case "updateReadChannelOutbox":
|
|
103
122
|
case "updateReadChannelInbox":
|
|
123
|
+
case "updateReadMonoForumInbox":
|
|
124
|
+
case "updateReadMonoForumOutbox":
|
|
104
125
|
return 0;
|
|
105
126
|
case "updateReadChannelDiscussionOutbox":
|
|
106
127
|
case "updateReadChannelDiscussionInbox":
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
2
|
export declare class HistoryReadUpdate {
|
|
3
|
-
readonly raw: tl.RawUpdateReadHistoryInbox | tl.RawUpdateReadHistoryOutbox | tl.RawUpdateReadChannelInbox | tl.RawUpdateReadChannelOutbox | tl.RawUpdateReadChannelDiscussionInbox | tl.RawUpdateReadChannelDiscussionOutbox;
|
|
4
|
-
constructor(raw: tl.RawUpdateReadHistoryInbox | tl.RawUpdateReadHistoryOutbox | tl.RawUpdateReadChannelInbox | tl.RawUpdateReadChannelOutbox | tl.RawUpdateReadChannelDiscussionInbox | tl.RawUpdateReadChannelDiscussionOutbox);
|
|
3
|
+
readonly raw: tl.RawUpdateReadHistoryInbox | tl.RawUpdateReadHistoryOutbox | tl.RawUpdateReadChannelInbox | tl.RawUpdateReadChannelOutbox | tl.RawUpdateReadChannelDiscussionInbox | tl.RawUpdateReadChannelDiscussionOutbox | tl.RawUpdateReadMonoForumInbox | tl.RawUpdateReadMonoForumOutbox;
|
|
4
|
+
constructor(raw: tl.RawUpdateReadHistoryInbox | tl.RawUpdateReadHistoryOutbox | tl.RawUpdateReadChannelInbox | tl.RawUpdateReadChannelOutbox | tl.RawUpdateReadChannelDiscussionInbox | tl.RawUpdateReadChannelDiscussionOutbox | tl.RawUpdateReadMonoForumInbox | tl.RawUpdateReadMonoForumOutbox);
|
|
5
5
|
/**
|
|
6
6
|
* Whether this update is about an "outbox" read
|
|
7
7
|
* (i.e. a message you have sent earlier was read)
|
|
@@ -12,6 +12,11 @@ export declare class HistoryReadUpdate {
|
|
|
12
12
|
* (e.g. a comments thread or a topic in a forum)
|
|
13
13
|
*/
|
|
14
14
|
get isDiscussion(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether this update is about messages in a "monoforum"
|
|
17
|
+
* (i.e. a chat used for "direct channel messages")
|
|
18
|
+
*/
|
|
19
|
+
get isMonoForum(): boolean;
|
|
15
20
|
/**
|
|
16
21
|
* Marked peer ID of the chat where the messages were read.
|
|
17
22
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
2
|
export declare class HistoryReadUpdate {
|
|
3
|
-
readonly raw: tl.RawUpdateReadHistoryInbox | tl.RawUpdateReadHistoryOutbox | tl.RawUpdateReadChannelInbox | tl.RawUpdateReadChannelOutbox | tl.RawUpdateReadChannelDiscussionInbox | tl.RawUpdateReadChannelDiscussionOutbox;
|
|
4
|
-
constructor(raw: tl.RawUpdateReadHistoryInbox | tl.RawUpdateReadHistoryOutbox | tl.RawUpdateReadChannelInbox | tl.RawUpdateReadChannelOutbox | tl.RawUpdateReadChannelDiscussionInbox | tl.RawUpdateReadChannelDiscussionOutbox);
|
|
3
|
+
readonly raw: tl.RawUpdateReadHistoryInbox | tl.RawUpdateReadHistoryOutbox | tl.RawUpdateReadChannelInbox | tl.RawUpdateReadChannelOutbox | tl.RawUpdateReadChannelDiscussionInbox | tl.RawUpdateReadChannelDiscussionOutbox | tl.RawUpdateReadMonoForumInbox | tl.RawUpdateReadMonoForumOutbox;
|
|
4
|
+
constructor(raw: tl.RawUpdateReadHistoryInbox | tl.RawUpdateReadHistoryOutbox | tl.RawUpdateReadChannelInbox | tl.RawUpdateReadChannelOutbox | tl.RawUpdateReadChannelDiscussionInbox | tl.RawUpdateReadChannelDiscussionOutbox | tl.RawUpdateReadMonoForumInbox | tl.RawUpdateReadMonoForumOutbox);
|
|
5
5
|
/**
|
|
6
6
|
* Whether this update is about an "outbox" read
|
|
7
7
|
* (i.e. a message you have sent earlier was read)
|
|
@@ -12,6 +12,11 @@ export declare class HistoryReadUpdate {
|
|
|
12
12
|
* (e.g. a comments thread or a topic in a forum)
|
|
13
13
|
*/
|
|
14
14
|
get isDiscussion(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether this update is about messages in a "monoforum"
|
|
17
|
+
* (i.e. a chat used for "direct channel messages")
|
|
18
|
+
*/
|
|
19
|
+
get isMonoForum(): boolean;
|
|
15
20
|
/**
|
|
16
21
|
* Marked peer ID of the chat where the messages were read.
|
|
17
22
|
*/
|
|
@@ -31,6 +31,19 @@ class HistoryReadUpdate {
|
|
|
31
31
|
return false;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether this update is about messages in a "monoforum"
|
|
36
|
+
* (i.e. a chat used for "direct channel messages")
|
|
37
|
+
*/
|
|
38
|
+
get isMonoForum() {
|
|
39
|
+
switch (this.raw._) {
|
|
40
|
+
case "updateReadMonoForumOutbox":
|
|
41
|
+
case "updateReadMonoForumInbox":
|
|
42
|
+
return true;
|
|
43
|
+
default:
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
34
47
|
/**
|
|
35
48
|
* Marked peer ID of the chat where the messages were read.
|
|
36
49
|
*/
|
|
@@ -43,6 +56,8 @@ class HistoryReadUpdate {
|
|
|
43
56
|
case "updateReadChannelInbox":
|
|
44
57
|
case "updateReadChannelDiscussionOutbox":
|
|
45
58
|
case "updateReadChannelDiscussionInbox":
|
|
59
|
+
case "updateReadMonoForumOutbox":
|
|
60
|
+
case "updateReadMonoForumInbox":
|
|
46
61
|
return toggleChannelIdMark(this.raw.channelId);
|
|
47
62
|
}
|
|
48
63
|
}
|
|
@@ -62,6 +77,8 @@ class HistoryReadUpdate {
|
|
|
62
77
|
case "updateReadHistoryOutbox":
|
|
63
78
|
case "updateReadChannelOutbox":
|
|
64
79
|
case "updateReadChannelDiscussionOutbox":
|
|
80
|
+
case "updateReadMonoForumOutbox":
|
|
81
|
+
case "updateReadMonoForumInbox":
|
|
65
82
|
return 0;
|
|
66
83
|
}
|
|
67
84
|
}
|
|
@@ -80,6 +97,8 @@ class HistoryReadUpdate {
|
|
|
80
97
|
return this.raw.maxId;
|
|
81
98
|
case "updateReadChannelDiscussionOutbox":
|
|
82
99
|
case "updateReadChannelDiscussionInbox":
|
|
100
|
+
case "updateReadMonoForumInbox":
|
|
101
|
+
case "updateReadMonoForumOutbox":
|
|
83
102
|
return this.raw.readMaxId;
|
|
84
103
|
}
|
|
85
104
|
}
|
|
@@ -94,6 +113,8 @@ class HistoryReadUpdate {
|
|
|
94
113
|
case "updateReadHistoryInbox":
|
|
95
114
|
case "updateReadChannelOutbox":
|
|
96
115
|
case "updateReadChannelInbox":
|
|
116
|
+
case "updateReadMonoForumInbox":
|
|
117
|
+
case "updateReadMonoForumOutbox":
|
|
97
118
|
return 0;
|
|
98
119
|
case "updateReadChannelDiscussionOutbox":
|
|
99
120
|
case "updateReadChannelDiscussionInbox":
|
package/methods.cjs
CHANGED
|
@@ -55,6 +55,7 @@ const getChatPreview = require("./highlevel/methods/chats/get-chat-preview.cjs")
|
|
|
55
55
|
const getChat = require("./highlevel/methods/chats/get-chat.cjs");
|
|
56
56
|
const getFullChat = require("./highlevel/methods/chats/get-full-chat.cjs");
|
|
57
57
|
const getFullUser = require("./highlevel/methods/chats/get-full-user.cjs");
|
|
58
|
+
const getMessageAuthor = require("./highlevel/methods/chats/get-message-author.cjs");
|
|
58
59
|
const getNearbyChats = require("./highlevel/methods/chats/get-nearby-chats.cjs");
|
|
59
60
|
const getPeer = require("./highlevel/methods/chats/get-peer.cjs");
|
|
60
61
|
const getSimilarChannels = require("./highlevel/methods/chats/get-similar-channels.cjs");
|
|
@@ -322,6 +323,7 @@ exports.getChatPreview = getChatPreview.getChatPreview;
|
|
|
322
323
|
exports.getChat = getChat.getChat;
|
|
323
324
|
exports.getFullChat = getFullChat.getFullChat;
|
|
324
325
|
exports.getFullUser = getFullUser.getFullUser;
|
|
326
|
+
exports.getMessageAuthor = getMessageAuthor.getMessageAuthor;
|
|
325
327
|
exports.getNearbyChats = getNearbyChats.getNearbyChats;
|
|
326
328
|
exports.getPeer = getPeer.getPeer;
|
|
327
329
|
exports.getSimilarChannels = getSimilarChannels.getSimilarChannels;
|
|
@@ -383,6 +385,7 @@ exports.reorderPinnedForumTopics = reorderPinnedForumTopics.reorderPinnedForumTo
|
|
|
383
385
|
exports.toggleForumTopicClosed = toggleForumTopicClosed.toggleForumTopicClosed;
|
|
384
386
|
exports.toggleForumTopicPinned = toggleForumTopicPinned.toggleForumTopicPinned;
|
|
385
387
|
exports.toggleForum = toggleForum.toggleForum;
|
|
388
|
+
exports.updateForumSettings = toggleForum.updateForumSettings;
|
|
386
389
|
exports.toggleGeneralTopicHidden = toggleGeneralTopicHidden.toggleGeneralTopicHidden;
|
|
387
390
|
exports.createInviteLink = createInviteLink.createInviteLink;
|
|
388
391
|
exports.editInviteLink = editInviteLink.editInviteLink;
|
package/methods.js
CHANGED
|
@@ -48,6 +48,7 @@ import { getChatPreview } from "./highlevel/methods/chats/get-chat-preview.js";
|
|
|
48
48
|
import { getChat } from "./highlevel/methods/chats/get-chat.js";
|
|
49
49
|
import { getFullChat } from "./highlevel/methods/chats/get-full-chat.js";
|
|
50
50
|
import { getFullUser } from "./highlevel/methods/chats/get-full-user.js";
|
|
51
|
+
import { getMessageAuthor } from "./highlevel/methods/chats/get-message-author.js";
|
|
51
52
|
import { getNearbyChats } from "./highlevel/methods/chats/get-nearby-chats.js";
|
|
52
53
|
import { getPeer } from "./highlevel/methods/chats/get-peer.js";
|
|
53
54
|
import { getSimilarChannels } from "./highlevel/methods/chats/get-similar-channels.js";
|
|
@@ -107,7 +108,7 @@ import { iterForumTopics } from "./highlevel/methods/forums/iter-forum-topics.js
|
|
|
107
108
|
import { reorderPinnedForumTopics } from "./highlevel/methods/forums/reorder-pinned-forum-topics.js";
|
|
108
109
|
import { toggleForumTopicClosed } from "./highlevel/methods/forums/toggle-forum-topic-closed.js";
|
|
109
110
|
import { toggleForumTopicPinned } from "./highlevel/methods/forums/toggle-forum-topic-pinned.js";
|
|
110
|
-
import { toggleForum } from "./highlevel/methods/forums/toggle-forum.js";
|
|
111
|
+
import { toggleForum, updateForumSettings } from "./highlevel/methods/forums/toggle-forum.js";
|
|
111
112
|
import { toggleGeneralTopicHidden } from "./highlevel/methods/forums/toggle-general-topic-hidden.js";
|
|
112
113
|
import { createInviteLink } from "./highlevel/methods/invite-links/create-invite-link.js";
|
|
113
114
|
import { editInviteLink } from "./highlevel/methods/invite-links/edit-invite-link.js";
|
|
@@ -374,6 +375,7 @@ export {
|
|
|
374
375
|
getInviteLinkMembers,
|
|
375
376
|
getInviteLinks,
|
|
376
377
|
getMe,
|
|
378
|
+
getMessageAuthor,
|
|
377
379
|
getMessageByLink,
|
|
378
380
|
getMessageGroup,
|
|
379
381
|
getMessageReactions,
|
|
@@ -547,6 +549,7 @@ export {
|
|
|
547
549
|
unblockUser,
|
|
548
550
|
unpinAllMessages,
|
|
549
551
|
unpinMessage,
|
|
552
|
+
updateForumSettings,
|
|
550
553
|
updateProfile,
|
|
551
554
|
upgradeStarGift,
|
|
552
555
|
uploadFile,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.24.
|
|
4
|
+
"version": "0.24.2",
|
|
5
5
|
"description": "Type-safe library for MTProto (Telegram API)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@fuman/net": "0.0.14",
|
|
11
11
|
"@fuman/utils": "0.0.14",
|
|
12
12
|
"@mtcute/file-id": "^0.23.0",
|
|
13
|
-
"@mtcute/tl": "^
|
|
13
|
+
"@mtcute/tl": "^204.0.0",
|
|
14
14
|
"@mtcute/tl-runtime": "^0.23.0",
|
|
15
15
|
"@types/events": "3.0.0",
|
|
16
16
|
"long": "5.2.3"
|
package/utils/binary/compat.cjs
CHANGED
|
@@ -73,6 +73,8 @@ function mapCompatMessageAction(obj) {
|
|
|
73
73
|
_: "messageActionStarGift",
|
|
74
74
|
gift: mapCompatStarGift(obj.gift)
|
|
75
75
|
};
|
|
76
|
+
case "messageActionPaidMessagesPrice_layer203":
|
|
77
|
+
return replaceType(obj, "messageActionPaidMessagesPrice");
|
|
76
78
|
default:
|
|
77
79
|
return obj;
|
|
78
80
|
}
|
|
@@ -93,6 +95,7 @@ function mapCompatObject(obj) {
|
|
|
93
95
|
case "messageActionStarGiftUnique_layer197":
|
|
94
96
|
case "messageActionStarGift_layer197":
|
|
95
97
|
case "messageActionStarGiftUnique_layer202":
|
|
98
|
+
case "messageActionPaidMessagesPrice_layer203":
|
|
96
99
|
return mapCompatMessageAction(obj);
|
|
97
100
|
case "userFull_layer199":
|
|
98
101
|
return replaceType(dropFields(obj, ["premiumGifts"]), "userFull");
|
|
@@ -105,6 +108,7 @@ function mapCompatObject(obj) {
|
|
|
105
108
|
emojiStatus: obj.emojiStatus ? mapCompatEmojiStatus(obj.emojiStatus) : void 0
|
|
106
109
|
};
|
|
107
110
|
case "channel_layer199":
|
|
111
|
+
case "channel_layer203":
|
|
108
112
|
return {
|
|
109
113
|
...obj,
|
|
110
114
|
_: "channel",
|
package/utils/binary/compat.js
CHANGED
|
@@ -66,6 +66,8 @@ function mapCompatMessageAction(obj) {
|
|
|
66
66
|
_: "messageActionStarGift",
|
|
67
67
|
gift: mapCompatStarGift(obj.gift)
|
|
68
68
|
};
|
|
69
|
+
case "messageActionPaidMessagesPrice_layer203":
|
|
70
|
+
return replaceType(obj, "messageActionPaidMessagesPrice");
|
|
69
71
|
default:
|
|
70
72
|
return obj;
|
|
71
73
|
}
|
|
@@ -86,6 +88,7 @@ function mapCompatObject(obj) {
|
|
|
86
88
|
case "messageActionStarGiftUnique_layer197":
|
|
87
89
|
case "messageActionStarGift_layer197":
|
|
88
90
|
case "messageActionStarGiftUnique_layer202":
|
|
91
|
+
case "messageActionPaidMessagesPrice_layer203":
|
|
89
92
|
return mapCompatMessageAction(obj);
|
|
90
93
|
case "userFull_layer199":
|
|
91
94
|
return replaceType(dropFields(obj, ["premiumGifts"]), "userFull");
|
|
@@ -98,6 +101,7 @@ function mapCompatObject(obj) {
|
|
|
98
101
|
emojiStatus: obj.emojiStatus ? mapCompatEmojiStatus(obj.emojiStatus) : void 0
|
|
99
102
|
};
|
|
100
103
|
case "channel_layer199":
|
|
104
|
+
case "channel_layer203":
|
|
101
105
|
return {
|
|
102
106
|
...obj,
|
|
103
107
|
_: "channel",
|
package/utils/peer-utils.cjs
CHANGED
|
@@ -8,11 +8,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
8
8
|
const errors = require("../types/errors.cjs");
|
|
9
9
|
const utils = require("../types/utils.cjs");
|
|
10
10
|
const ZERO_CHANNEL_ID = -1e12;
|
|
11
|
-
const ZERO_SECRET_CHAT_ID = -2e12;
|
|
12
|
-
const MAX_SECRET_CHAT_ID = -1997852516353;
|
|
13
11
|
const MIN_MARKED_CHAT_ID = -999999999999;
|
|
14
12
|
const MAX_USER_ID = 1099511627775;
|
|
15
|
-
const MIN_MARKED_CHANNEL_ID = -1997852516352;
|
|
16
13
|
function toggleChannelIdMark(id) {
|
|
17
14
|
return ZERO_CHANNEL_ID - id;
|
|
18
15
|
}
|
|
@@ -64,12 +61,9 @@ function parseMarkedPeerId(id) {
|
|
|
64
61
|
if (MIN_MARKED_CHAT_ID <= id) {
|
|
65
62
|
return ["chat", -id];
|
|
66
63
|
}
|
|
67
|
-
if (
|
|
64
|
+
if (id !== ZERO_CHANNEL_ID) {
|
|
68
65
|
return ["channel", ZERO_CHANNEL_ID - id];
|
|
69
66
|
}
|
|
70
|
-
if (MAX_SECRET_CHAT_ID >= id && id !== ZERO_SECRET_CHAT_ID) {
|
|
71
|
-
throw new errors.MtUnsupportedError("Secret chats are not supported");
|
|
72
|
-
}
|
|
73
67
|
} else if (id > 0 && id <= MAX_USER_ID) {
|
|
74
68
|
return ["user", id];
|
|
75
69
|
}
|
|
@@ -143,7 +137,7 @@ function getBasicPeerType(id) {
|
|
|
143
137
|
if (MIN_MARKED_CHAT_ID <= id) {
|
|
144
138
|
return "chat";
|
|
145
139
|
}
|
|
146
|
-
if (
|
|
140
|
+
if (id !== ZERO_CHANNEL_ID) {
|
|
147
141
|
return "channel";
|
|
148
142
|
}
|
|
149
143
|
} else if (id > 0 && id <= MAX_USER_ID) {
|
package/utils/peer-utils.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { MtArgumentError
|
|
1
|
+
import { MtArgumentError } from "../types/errors.js";
|
|
2
2
|
import { assertNever } from "../types/utils.js";
|
|
3
3
|
const ZERO_CHANNEL_ID = -1e12;
|
|
4
|
-
const ZERO_SECRET_CHAT_ID = -2e12;
|
|
5
|
-
const MAX_SECRET_CHAT_ID = -1997852516353;
|
|
6
4
|
const MIN_MARKED_CHAT_ID = -999999999999;
|
|
7
5
|
const MAX_USER_ID = 1099511627775;
|
|
8
|
-
const MIN_MARKED_CHANNEL_ID = -1997852516352;
|
|
9
6
|
function toggleChannelIdMark(id) {
|
|
10
7
|
return ZERO_CHANNEL_ID - id;
|
|
11
8
|
}
|
|
@@ -57,12 +54,9 @@ function parseMarkedPeerId(id) {
|
|
|
57
54
|
if (MIN_MARKED_CHAT_ID <= id) {
|
|
58
55
|
return ["chat", -id];
|
|
59
56
|
}
|
|
60
|
-
if (
|
|
57
|
+
if (id !== ZERO_CHANNEL_ID) {
|
|
61
58
|
return ["channel", ZERO_CHANNEL_ID - id];
|
|
62
59
|
}
|
|
63
|
-
if (MAX_SECRET_CHAT_ID >= id && id !== ZERO_SECRET_CHAT_ID) {
|
|
64
|
-
throw new MtUnsupportedError("Secret chats are not supported");
|
|
65
|
-
}
|
|
66
60
|
} else if (id > 0 && id <= MAX_USER_ID) {
|
|
67
61
|
return ["user", id];
|
|
68
62
|
}
|
|
@@ -136,7 +130,7 @@ function getBasicPeerType(id) {
|
|
|
136
130
|
if (MIN_MARKED_CHAT_ID <= id) {
|
|
137
131
|
return "chat";
|
|
138
132
|
}
|
|
139
|
-
if (
|
|
133
|
+
if (id !== ZERO_CHANNEL_ID) {
|
|
140
134
|
return "channel";
|
|
141
135
|
}
|
|
142
136
|
} else if (id > 0 && id <= MAX_USER_ID) {
|