@mtcute/core 0.27.8 → 0.28.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 +4 -0
- package/client.js +4 -0
- package/highlevel/client.d.cts +8 -0
- package/highlevel/client.d.ts +8 -0
- package/highlevel/methods/chats/get-creator-after-leave.cjs +18 -0
- package/highlevel/methods/chats/get-creator-after-leave.d.cts +9 -0
- package/highlevel/methods/chats/get-creator-after-leave.d.ts +9 -0
- package/highlevel/methods/chats/get-creator-after-leave.js +13 -0
- package/highlevel/methods/dialogs/iter-dialogs.cjs +4 -0
- package/highlevel/methods/dialogs/iter-dialogs.js +4 -0
- package/highlevel/methods/files/download-iterable.cjs +17 -6
- package/highlevel/methods/files/download-iterable.js +17 -6
- package/highlevel/methods/gifts/get-resale-star-gifts.cjs +2 -1
- package/highlevel/methods/gifts/get-resale-star-gifts.d.cts +2 -0
- package/highlevel/methods/gifts/get-resale-star-gifts.d.ts +2 -0
- package/highlevel/methods/gifts/get-resale-star-gifts.js +2 -1
- package/highlevel/methods.d.cts +1 -0
- package/highlevel/methods.d.ts +1 -0
- package/highlevel/types/bots/keyboards/factories.cjs +26 -18
- package/highlevel/types/bots/keyboards/factories.d.cts +34 -10
- package/highlevel/types/bots/keyboards/factories.d.ts +34 -10
- package/highlevel/types/bots/keyboards/factories.js +26 -18
- package/highlevel/types/messages/message-action.cjs +18 -0
- package/highlevel/types/messages/message-action.d.cts +20 -1
- package/highlevel/types/messages/message-action.d.ts +20 -1
- package/highlevel/types/messages/message-action.js +18 -0
- package/highlevel/types/peers/chat.cjs +1 -1
- package/highlevel/types/peers/chat.js +1 -1
- package/highlevel/types/peers/user.cjs +3 -0
- package/highlevel/types/peers/user.d.cts +1 -0
- package/highlevel/types/peers/user.d.ts +1 -0
- package/highlevel/types/peers/user.js +3 -0
- package/highlevel/types/premium/saved-star-gift.cjs +4 -0
- package/highlevel/types/premium/saved-star-gift.d.cts +2 -0
- package/highlevel/types/premium/saved-star-gift.d.ts +2 -0
- package/highlevel/types/premium/saved-star-gift.js +4 -0
- package/highlevel/types/premium/star-gift-unique.cjs +43 -4
- package/highlevel/types/premium/star-gift-unique.d.cts +18 -4
- package/highlevel/types/premium/star-gift-unique.d.ts +18 -4
- package/highlevel/types/premium/star-gift-unique.js +43 -4
- package/highlevel/updates/manager.cjs +11 -0
- package/highlevel/updates/manager.d.cts +2 -1
- package/highlevel/updates/manager.d.ts +2 -1
- package/highlevel/updates/manager.js +12 -1
- package/index.cjs +2 -0
- package/index.js +2 -0
- package/methods.cjs +2 -0
- package/methods.js +2 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/network/server-salt.cjs +2 -7
- package/network/server-salt.js +2 -7
- package/network/transports/index.d.cts +1 -0
- package/network/transports/index.d.ts +1 -0
- package/network/transports/proxy.cjs +46 -0
- package/network/transports/proxy.d.cts +10 -0
- package/network/transports/proxy.d.ts +10 -0
- package/network/transports/proxy.js +41 -0
- package/network/transports/proxy.test.d.cts +1 -0
- package/network/transports/proxy.test.d.ts +1 -0
- package/package.json +2 -2
- package/utils/binary/compat.cjs +105 -4
- package/utils/binary/compat.js +105 -4
package/client.cjs
CHANGED
|
@@ -54,6 +54,7 @@ const getChatMember = require("./highlevel/methods/chats/get-chat-member.cjs");
|
|
|
54
54
|
const getChatMembers = require("./highlevel/methods/chats/get-chat-members.cjs");
|
|
55
55
|
const getChatPreview = require("./highlevel/methods/chats/get-chat-preview.cjs");
|
|
56
56
|
const getChat = require("./highlevel/methods/chats/get-chat.cjs");
|
|
57
|
+
const getCreatorAfterLeave = require("./highlevel/methods/chats/get-creator-after-leave.cjs");
|
|
57
58
|
const getFullChat = require("./highlevel/methods/chats/get-full-chat.cjs");
|
|
58
59
|
const getFullUser = require("./highlevel/methods/chats/get-full-user.cjs");
|
|
59
60
|
const getMessageAuthor = require("./highlevel/methods/chats/get-message-author.cjs");
|
|
@@ -597,6 +598,9 @@ TelegramClient.prototype.getChatPreview = function(...args) {
|
|
|
597
598
|
TelegramClient.prototype.getChat = function(...args) {
|
|
598
599
|
return getChat.getChat(this._client, ...args);
|
|
599
600
|
};
|
|
601
|
+
TelegramClient.prototype.getCreatorAfterLeave = function(...args) {
|
|
602
|
+
return getCreatorAfterLeave.getCreatorAfterLeave(this._client, ...args);
|
|
603
|
+
};
|
|
600
604
|
TelegramClient.prototype.getFullChat = function(...args) {
|
|
601
605
|
return getFullChat.getFullChat(this._client, ...args);
|
|
602
606
|
};
|
package/client.js
CHANGED
|
@@ -47,6 +47,7 @@ import { getChatMember } from "./highlevel/methods/chats/get-chat-member.js";
|
|
|
47
47
|
import { getChatMembers } from "./highlevel/methods/chats/get-chat-members.js";
|
|
48
48
|
import { getChatPreview } from "./highlevel/methods/chats/get-chat-preview.js";
|
|
49
49
|
import { getChat } from "./highlevel/methods/chats/get-chat.js";
|
|
50
|
+
import { getCreatorAfterLeave } from "./highlevel/methods/chats/get-creator-after-leave.js";
|
|
50
51
|
import { getFullChat } from "./highlevel/methods/chats/get-full-chat.js";
|
|
51
52
|
import { getFullUser } from "./highlevel/methods/chats/get-full-user.js";
|
|
52
53
|
import { getMessageAuthor } from "./highlevel/methods/chats/get-message-author.js";
|
|
@@ -590,6 +591,9 @@ TelegramClient.prototype.getChatPreview = function(...args) {
|
|
|
590
591
|
TelegramClient.prototype.getChat = function(...args) {
|
|
591
592
|
return getChat(this._client, ...args);
|
|
592
593
|
};
|
|
594
|
+
TelegramClient.prototype.getCreatorAfterLeave = function(...args) {
|
|
595
|
+
return getCreatorAfterLeave(this._client, ...args);
|
|
596
|
+
};
|
|
593
597
|
TelegramClient.prototype.getFullChat = function(...args) {
|
|
594
598
|
return getFullChat(this._client, ...args);
|
|
595
599
|
};
|
package/highlevel/client.d.cts
CHANGED
|
@@ -1258,6 +1258,12 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
1258
1258
|
* Use {@link getChatPreview} instead.
|
|
1259
1259
|
*/
|
|
1260
1260
|
getChat(chatId: InputPeerLike): Promise<Chat>;
|
|
1261
|
+
/**
|
|
1262
|
+
* Get the user who will be made the creator of the channel/supergroup if you were to leave it.
|
|
1263
|
+
*
|
|
1264
|
+
* You must be the creator of the channel/supergroup to use this method.
|
|
1265
|
+
*/
|
|
1266
|
+
getCreatorAfterLeave(chatId: InputPeerLike): Promise<User | null>;
|
|
1261
1267
|
/**
|
|
1262
1268
|
* Get full information about a chat.
|
|
1263
1269
|
*
|
|
@@ -2447,6 +2453,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
2447
2453
|
* - `num`: Sort by its unique number
|
|
2448
2454
|
*/
|
|
2449
2455
|
sort?: 'price' | 'num';
|
|
2456
|
+
/** Whether to filter for options that can be used in a craft */
|
|
2457
|
+
forCraft?: boolean;
|
|
2450
2458
|
/**
|
|
2451
2459
|
* Hash of the `attributes` field, as returned by the server in the first response
|
|
2452
2460
|
*/
|
package/highlevel/client.d.ts
CHANGED
|
@@ -1258,6 +1258,12 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
1258
1258
|
* Use {@link getChatPreview} instead.
|
|
1259
1259
|
*/
|
|
1260
1260
|
getChat(chatId: InputPeerLike): Promise<Chat>;
|
|
1261
|
+
/**
|
|
1262
|
+
* Get the user who will be made the creator of the channel/supergroup if you were to leave it.
|
|
1263
|
+
*
|
|
1264
|
+
* You must be the creator of the channel/supergroup to use this method.
|
|
1265
|
+
*/
|
|
1266
|
+
getCreatorAfterLeave(chatId: InputPeerLike): Promise<User | null>;
|
|
1261
1267
|
/**
|
|
1262
1268
|
* Get full information about a chat.
|
|
1263
1269
|
*
|
|
@@ -2447,6 +2453,8 @@ export interface TelegramClient extends ITelegramClient {
|
|
|
2447
2453
|
* - `num`: Sort by its unique number
|
|
2448
2454
|
*/
|
|
2449
2455
|
sort?: 'price' | 'num';
|
|
2456
|
+
/** Whether to filter for options that can be used in a craft */
|
|
2457
|
+
forCraft?: boolean;
|
|
2450
2458
|
/**
|
|
2451
2459
|
* Hash of the `attributes` field, as returned by the server in the first response
|
|
2452
2460
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
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 user = require("../../types/peers/user.cjs");
|
|
9
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
10
|
+
async function getCreatorAfterLeave(client, chatId) {
|
|
11
|
+
const res = await client.call({
|
|
12
|
+
_: "channels.getFutureCreatorAfterLeave",
|
|
13
|
+
channel: await resolvePeer.resolveChannel(client, chatId)
|
|
14
|
+
});
|
|
15
|
+
if (res._ === "userEmpty") return null;
|
|
16
|
+
return new user.User(res);
|
|
17
|
+
}
|
|
18
|
+
exports.getCreatorAfterLeave = getCreatorAfterLeave;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/peers/peer.js';
|
|
3
|
+
import { User } from '../../types/peers/user.js';
|
|
4
|
+
/**
|
|
5
|
+
* Get the user who will be made the creator of the channel/supergroup if you were to leave it.
|
|
6
|
+
*
|
|
7
|
+
* You must be the creator of the channel/supergroup to use this method.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCreatorAfterLeave(client: ITelegramClient, chatId: InputPeerLike): Promise<User | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/peers/peer.js';
|
|
3
|
+
import { User } from '../../types/peers/user.js';
|
|
4
|
+
/**
|
|
5
|
+
* Get the user who will be made the creator of the channel/supergroup if you were to leave it.
|
|
6
|
+
*
|
|
7
|
+
* You must be the creator of the channel/supergroup to use this method.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCreatorAfterLeave(client: ITelegramClient, chatId: InputPeerLike): Promise<User | null>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { User as User$2 } from "../../types/peers/user.js";
|
|
2
|
+
import { resolveChannel } from "../users/resolve-peer.js";
|
|
3
|
+
async function getCreatorAfterLeave(client, chatId) {
|
|
4
|
+
const res = await client.call({
|
|
5
|
+
_: "channels.getFutureCreatorAfterLeave",
|
|
6
|
+
channel: await resolveChannel(client, chatId)
|
|
7
|
+
});
|
|
8
|
+
if (res._ === "userEmpty") return null;
|
|
9
|
+
return new User$2(res);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
getCreatorAfterLeave
|
|
13
|
+
};
|
|
@@ -158,6 +158,10 @@ async function* iterDialogs(client, params) {
|
|
|
158
158
|
}
|
|
159
159
|
for (const d of dialogs) {
|
|
160
160
|
if (filterFolder && !filterFolder(d)) continue;
|
|
161
|
+
if (d.isPinned) {
|
|
162
|
+
if (archived === "exclude" && d.isArchived) continue;
|
|
163
|
+
if (archived === "only" && !d.isArchived) continue;
|
|
164
|
+
}
|
|
161
165
|
yield d;
|
|
162
166
|
if (++current >= limit) return;
|
|
163
167
|
}
|
|
@@ -151,6 +151,10 @@ async function* iterDialogs(client, params) {
|
|
|
151
151
|
}
|
|
152
152
|
for (const d of dialogs) {
|
|
153
153
|
if (filterFolder && !filterFolder(d)) continue;
|
|
154
|
+
if (d.isPinned) {
|
|
155
|
+
if (archived === "exclude" && d.isArchived) continue;
|
|
156
|
+
if (archived === "only" && !d.isArchived) continue;
|
|
157
|
+
}
|
|
154
158
|
yield d;
|
|
155
159
|
if (++current >= limit) return;
|
|
156
160
|
}
|
|
@@ -18,16 +18,23 @@ const SMALL_FILE_MAX_SIZE = 131072;
|
|
|
18
18
|
const REQUESTS_PER_CONNECTION = 3;
|
|
19
19
|
async function _normalizeFileDownloadLocation(client, input) {
|
|
20
20
|
let location;
|
|
21
|
+
let dcId;
|
|
22
|
+
let fileSize;
|
|
21
23
|
if (input instanceof fileLocation.FileLocation) {
|
|
22
24
|
let locationInner = input.location;
|
|
23
25
|
if (typeof locationInner === "function") {
|
|
24
26
|
locationInner = locationInner();
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (ArrayBuffer.isView(locationInner)) {
|
|
29
|
+
return {
|
|
30
|
+
location: locationInner,
|
|
31
|
+
dcId: input.dcId,
|
|
32
|
+
fileSize: input.fileSize
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
location = locationInner;
|
|
36
|
+
dcId = input.dcId;
|
|
37
|
+
fileSize = input.fileSize;
|
|
31
38
|
} else if (typeof input === "string") {
|
|
32
39
|
const parsed = fileId.parseFileId(input);
|
|
33
40
|
if (parsed.location._ === "web") {
|
|
@@ -61,7 +68,11 @@ async function _normalizeFileDownloadLocation(client, input) {
|
|
|
61
68
|
};
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
location,
|
|
73
|
+
dcId,
|
|
74
|
+
fileSize
|
|
75
|
+
};
|
|
65
76
|
}
|
|
66
77
|
async function* downloadAsIterable(client, input, params) {
|
|
67
78
|
const offset = params?.offset ?? 0;
|
|
@@ -11,16 +11,23 @@ const SMALL_FILE_MAX_SIZE = 131072;
|
|
|
11
11
|
const REQUESTS_PER_CONNECTION = 3;
|
|
12
12
|
async function _normalizeFileDownloadLocation(client, input) {
|
|
13
13
|
let location;
|
|
14
|
+
let dcId;
|
|
15
|
+
let fileSize;
|
|
14
16
|
if (input instanceof FileLocation$1) {
|
|
15
17
|
let locationInner = input.location;
|
|
16
18
|
if (typeof locationInner === "function") {
|
|
17
19
|
locationInner = locationInner();
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (ArrayBuffer.isView(locationInner)) {
|
|
22
|
+
return {
|
|
23
|
+
location: locationInner,
|
|
24
|
+
dcId: input.dcId,
|
|
25
|
+
fileSize: input.fileSize
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
location = locationInner;
|
|
29
|
+
dcId = input.dcId;
|
|
30
|
+
fileSize = input.fileSize;
|
|
24
31
|
} else if (typeof input === "string") {
|
|
25
32
|
const parsed = parseFileId(input);
|
|
26
33
|
if (parsed.location._ === "web") {
|
|
@@ -54,7 +61,11 @@ async function _normalizeFileDownloadLocation(client, input) {
|
|
|
54
61
|
};
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
|
-
return {
|
|
64
|
+
return {
|
|
65
|
+
location,
|
|
66
|
+
dcId,
|
|
67
|
+
fileSize
|
|
68
|
+
};
|
|
58
69
|
}
|
|
59
70
|
async function* downloadAsIterable(client, input, params) {
|
|
60
71
|
const offset = params?.offset ?? 0;
|
|
@@ -72,7 +72,8 @@ async function getStarGiftResaleOptions(client, params) {
|
|
|
72
72
|
giftId: params.giftId,
|
|
73
73
|
attributes: params.attributes ? _normalizeResaleAttributes(params.attributes) : void 0,
|
|
74
74
|
offset: params.offset ?? "",
|
|
75
|
-
limit: params.limit ?? 100
|
|
75
|
+
limit: params.limit ?? 100,
|
|
76
|
+
forCraft: params.forCraft
|
|
76
77
|
});
|
|
77
78
|
const peers = peersIndex.PeersIndex.from(res);
|
|
78
79
|
const attributes = {
|
|
@@ -32,6 +32,8 @@ export declare function getStarGiftResaleOptions(client: ITelegramClient, params
|
|
|
32
32
|
* - `num`: Sort by its unique number
|
|
33
33
|
*/
|
|
34
34
|
sort?: 'price' | 'num';
|
|
35
|
+
/** Whether to filter for options that can be used in a craft */
|
|
36
|
+
forCraft?: boolean;
|
|
35
37
|
/**
|
|
36
38
|
* Hash of the `attributes` field, as returned by the server in the first response
|
|
37
39
|
*/
|
|
@@ -32,6 +32,8 @@ export declare function getStarGiftResaleOptions(client: ITelegramClient, params
|
|
|
32
32
|
* - `num`: Sort by its unique number
|
|
33
33
|
*/
|
|
34
34
|
sort?: 'price' | 'num';
|
|
35
|
+
/** Whether to filter for options that can be used in a craft */
|
|
36
|
+
forCraft?: boolean;
|
|
35
37
|
/**
|
|
36
38
|
* Hash of the `attributes` field, as returned by the server in the first response
|
|
37
39
|
*/
|
|
@@ -65,7 +65,8 @@ async function getStarGiftResaleOptions(client, params) {
|
|
|
65
65
|
giftId: params.giftId,
|
|
66
66
|
attributes: params.attributes ? _normalizeResaleAttributes(params.attributes) : void 0,
|
|
67
67
|
offset: params.offset ?? "",
|
|
68
|
-
limit: params.limit ?? 100
|
|
68
|
+
limit: params.limit ?? 100,
|
|
69
|
+
forCraft: params.forCraft
|
|
69
70
|
});
|
|
70
71
|
const peers = PeersIndex.from(res);
|
|
71
72
|
const attributes = {
|
package/highlevel/methods.d.cts
CHANGED
|
@@ -50,6 +50,7 @@ export { getChatMember } from './methods/chats/get-chat-member.js';
|
|
|
50
50
|
export { getChatMembers } from './methods/chats/get-chat-members.js';
|
|
51
51
|
export { getChatPreview } from './methods/chats/get-chat-preview.js';
|
|
52
52
|
export { getChat } from './methods/chats/get-chat.js';
|
|
53
|
+
export { getCreatorAfterLeave } from './methods/chats/get-creator-after-leave.js';
|
|
53
54
|
export { getFullChat } from './methods/chats/get-full-chat.js';
|
|
54
55
|
export { getFullUser } from './methods/chats/get-full-user.js';
|
|
55
56
|
export { getMessageAuthor } from './methods/chats/get-message-author.js';
|
package/highlevel/methods.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export { getChatMember } from './methods/chats/get-chat-member.js';
|
|
|
50
50
|
export { getChatMembers } from './methods/chats/get-chat-members.js';
|
|
51
51
|
export { getChatPreview } from './methods/chats/get-chat-preview.js';
|
|
52
52
|
export { getChat } from './methods/chats/get-chat.js';
|
|
53
|
+
export { getCreatorAfterLeave } from './methods/chats/get-creator-after-leave.js';
|
|
53
54
|
export { getFullChat } from './methods/chats/get-full-chat.js';
|
|
54
55
|
export { getFullUser } from './methods/chats/get-full-user.js';
|
|
55
56
|
export { getMessageAuthor } from './methods/chats/get-message-author.js';
|
|
@@ -61,34 +61,37 @@ function requestPoll(text2, quiz) {
|
|
|
61
61
|
quiz
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
function url(text2, url2) {
|
|
64
|
+
function url(text2, url2, options) {
|
|
65
65
|
return {
|
|
66
66
|
_: "keyboardButtonUrl",
|
|
67
67
|
text: text2,
|
|
68
|
-
url: url2
|
|
68
|
+
url: url2,
|
|
69
|
+
style: options?.style
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
|
-
function callback(text2, data,
|
|
72
|
+
function callback(text2, data, options) {
|
|
72
73
|
return {
|
|
73
74
|
_: "keyboardButtonCallback",
|
|
74
75
|
text: text2,
|
|
75
|
-
requiresPassword,
|
|
76
|
+
requiresPassword: options?.requiresPassword,
|
|
77
|
+
style: options?.style,
|
|
76
78
|
data: typeof data === "string" ? utils.utf8.encoder.encode(data) : data
|
|
77
79
|
};
|
|
78
80
|
}
|
|
79
|
-
function switchInline(text2,
|
|
81
|
+
function switchInline(text2, options) {
|
|
80
82
|
return {
|
|
81
83
|
_: "keyboardButtonSwitchInline",
|
|
82
|
-
samePeer: currentChat,
|
|
84
|
+
samePeer: options?.currentChat,
|
|
85
|
+
style: options?.style,
|
|
83
86
|
text: text2,
|
|
84
|
-
query
|
|
87
|
+
query: options?.query ?? ""
|
|
85
88
|
};
|
|
86
89
|
}
|
|
87
|
-
function game(text2) {
|
|
88
|
-
return { _: "keyboardButtonGame", text: text2 };
|
|
90
|
+
function game(text2, options) {
|
|
91
|
+
return { _: "keyboardButtonGame", text: text2, style: options?.style };
|
|
89
92
|
}
|
|
90
|
-
function pay(text2) {
|
|
91
|
-
return { _: "keyboardButtonBuy", text: text2 };
|
|
93
|
+
function pay(text2, options) {
|
|
94
|
+
return { _: "keyboardButtonBuy", text: text2, style: options?.style };
|
|
92
95
|
}
|
|
93
96
|
function urlAuth(text2, url2, params = {}) {
|
|
94
97
|
return {
|
|
@@ -99,21 +102,24 @@ function urlAuth(text2, url2, params = {}) {
|
|
|
99
102
|
_: "inputUserSelf"
|
|
100
103
|
},
|
|
101
104
|
fwdText: params.fwdText,
|
|
102
|
-
requestWriteAccess: params.requestWriteAccess
|
|
105
|
+
requestWriteAccess: params.requestWriteAccess,
|
|
106
|
+
style: params.style
|
|
103
107
|
};
|
|
104
108
|
}
|
|
105
|
-
function webView(text2, url2) {
|
|
109
|
+
function webView(text2, url2, options) {
|
|
106
110
|
return {
|
|
107
111
|
_: "keyboardButtonWebView",
|
|
108
112
|
text: text2,
|
|
109
|
-
url: url2
|
|
113
|
+
url: url2,
|
|
114
|
+
style: options?.style
|
|
110
115
|
};
|
|
111
116
|
}
|
|
112
|
-
function userProfile(text2, user) {
|
|
117
|
+
function userProfile(text2, user, options) {
|
|
113
118
|
return {
|
|
114
119
|
_: "inputKeyboardButtonUserProfile",
|
|
115
120
|
text: text2,
|
|
116
|
-
userId: peerUtils.toInputUser(user)
|
|
121
|
+
userId: peerUtils.toInputUser(user),
|
|
122
|
+
style: options?.style
|
|
117
123
|
};
|
|
118
124
|
}
|
|
119
125
|
function requestPeer(text2, buttonId, params) {
|
|
@@ -122,14 +128,16 @@ function requestPeer(text2, buttonId, params) {
|
|
|
122
128
|
text: text2,
|
|
123
129
|
buttonId,
|
|
124
130
|
peerType: params.peerType,
|
|
125
|
-
maxQuantity: params.count ?? 1
|
|
131
|
+
maxQuantity: params.count ?? 1,
|
|
132
|
+
style: params.style
|
|
126
133
|
};
|
|
127
134
|
}
|
|
128
135
|
function copy(params) {
|
|
129
136
|
return {
|
|
130
137
|
_: "keyboardButtonCopy",
|
|
131
138
|
text: params.text,
|
|
132
|
-
copyText: params?.copyText ?? params.text
|
|
139
|
+
copyText: params?.copyText ?? params.text,
|
|
140
|
+
style: params.style
|
|
133
141
|
};
|
|
134
142
|
}
|
|
135
143
|
function findButton(buttons, predicate) {
|
|
@@ -73,7 +73,9 @@ export declare function requestPoll(text: string, quiz?: boolean): tl.RawKeyboar
|
|
|
73
73
|
* @param text Button text
|
|
74
74
|
* @param url URL
|
|
75
75
|
*/
|
|
76
|
-
export declare function url(text: string, url: string
|
|
76
|
+
export declare function url(text: string, url: string, options?: {
|
|
77
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
78
|
+
}): tl.RawKeyboardButtonUrl;
|
|
77
79
|
/**
|
|
78
80
|
* Create a keyboard button with a link.
|
|
79
81
|
*
|
|
@@ -85,7 +87,10 @@ export declare function url(text: string, url: string): tl.RawKeyboardButtonUrl;
|
|
|
85
87
|
* Whether the user should verify their identity by entering 2FA password.
|
|
86
88
|
* See more: {@link tl.RawKeyboardButtonCallback#requiresPassword}
|
|
87
89
|
*/
|
|
88
|
-
export declare function callback(text: string, data: string | Uint8Array,
|
|
90
|
+
export declare function callback(text: string, data: string | Uint8Array, options?: {
|
|
91
|
+
requiresPassword?: boolean;
|
|
92
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
93
|
+
}): tl.RawKeyboardButtonCallback;
|
|
89
94
|
/**
|
|
90
95
|
* Button to force a user to switch to inline mode.
|
|
91
96
|
*
|
|
@@ -97,11 +102,19 @@ export declare function callback(text: string, data: string | Uint8Array, requir
|
|
|
97
102
|
*
|
|
98
103
|
* @param text Button text
|
|
99
104
|
* @param query Inline query (can be empty or omitted)
|
|
100
|
-
* @param currentChat
|
|
101
|
-
* If set, pressing the button will insert the bot's username
|
|
102
|
-
* and the specified inline query in the current chat's input field
|
|
103
105
|
*/
|
|
104
|
-
export declare function switchInline(text: string,
|
|
106
|
+
export declare function switchInline(text: string, options?: {
|
|
107
|
+
/**
|
|
108
|
+
* Inline query (can be empty or omitted)
|
|
109
|
+
*/
|
|
110
|
+
query?: string;
|
|
111
|
+
/**
|
|
112
|
+
* If set, pressing the button will insert the bot's username
|
|
113
|
+
* and the specified inline query in the current chat's input field
|
|
114
|
+
*/
|
|
115
|
+
currentChat?: boolean;
|
|
116
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
117
|
+
}): tl.RawKeyboardButtonSwitchInline;
|
|
105
118
|
/**
|
|
106
119
|
* Button to start a game
|
|
107
120
|
*
|
|
@@ -112,7 +125,9 @@ export declare function switchInline(text: string, query?: string, currentChat?:
|
|
|
112
125
|
* game is inferred from {@link InputMedia.game},
|
|
113
126
|
* thus this button should only be used with it.
|
|
114
127
|
*/
|
|
115
|
-
export declare function game(text: string
|
|
128
|
+
export declare function game(text: string, options?: {
|
|
129
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
130
|
+
}): tl.RawKeyboardButtonGame;
|
|
116
131
|
/**
|
|
117
132
|
* Button to pay for a product.
|
|
118
133
|
*
|
|
@@ -123,7 +138,9 @@ export declare function game(text: string): tl.RawKeyboardButtonGame;
|
|
|
123
138
|
* invoice is inferred from {@link InputMedia.invoice},
|
|
124
139
|
* thus this button should only be used with it.
|
|
125
140
|
*/
|
|
126
|
-
export declare function pay(text: string
|
|
141
|
+
export declare function pay(text: string, options?: {
|
|
142
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
143
|
+
}): tl.RawKeyboardButtonBuy;
|
|
127
144
|
/**
|
|
128
145
|
* Button to authorize a user
|
|
129
146
|
*
|
|
@@ -143,6 +160,7 @@ export declare function urlAuth(text: string, url: string, params?: {
|
|
|
143
160
|
* your bot to send messages to the user
|
|
144
161
|
*/
|
|
145
162
|
requestWriteAccess?: boolean;
|
|
163
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
146
164
|
/**
|
|
147
165
|
* Bot, which will be used for user authorization.
|
|
148
166
|
* `url` domain must be the same as the domain linked
|
|
@@ -160,14 +178,18 @@ export declare function urlAuth(text: string, url: string, params?: {
|
|
|
160
178
|
* @param text Button label
|
|
161
179
|
* @param url WebView URL
|
|
162
180
|
*/
|
|
163
|
-
export declare function webView(text: string, url: string
|
|
181
|
+
export declare function webView(text: string, url: string, options?: {
|
|
182
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
183
|
+
}): tl.RawKeyboardButtonWebView;
|
|
164
184
|
/**
|
|
165
185
|
* Button to open user profile
|
|
166
186
|
*
|
|
167
187
|
* @param text Text of the button
|
|
168
188
|
* @param user User to be opened (use {@link TelegramClient.resolvePeer})
|
|
169
189
|
*/
|
|
170
|
-
export declare function userProfile(text: string, user: tl.TypeInputPeer
|
|
190
|
+
export declare function userProfile(text: string, user: tl.TypeInputPeer, options?: {
|
|
191
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
192
|
+
}): tl.RawInputKeyboardButtonUserProfile;
|
|
171
193
|
/**
|
|
172
194
|
* Button to request a peer from the user
|
|
173
195
|
*
|
|
@@ -185,6 +207,7 @@ export declare function requestPeer(text: string, buttonId: number, params: {
|
|
|
185
207
|
* @default 1
|
|
186
208
|
*/
|
|
187
209
|
count?: number;
|
|
210
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
188
211
|
}): tl.RawKeyboardButtonRequestPeer;
|
|
189
212
|
/**
|
|
190
213
|
* Button to copy text to the user's clipboard
|
|
@@ -192,6 +215,7 @@ export declare function requestPeer(text: string, buttonId: number, params: {
|
|
|
192
215
|
export declare function copy(params: {
|
|
193
216
|
text: string;
|
|
194
217
|
copyText?: string;
|
|
218
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
195
219
|
}): tl.RawKeyboardButtonCopy;
|
|
196
220
|
/**
|
|
197
221
|
* Find a button in the keyboard by its text or by predicate
|
|
@@ -73,7 +73,9 @@ export declare function requestPoll(text: string, quiz?: boolean): tl.RawKeyboar
|
|
|
73
73
|
* @param text Button text
|
|
74
74
|
* @param url URL
|
|
75
75
|
*/
|
|
76
|
-
export declare function url(text: string, url: string
|
|
76
|
+
export declare function url(text: string, url: string, options?: {
|
|
77
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
78
|
+
}): tl.RawKeyboardButtonUrl;
|
|
77
79
|
/**
|
|
78
80
|
* Create a keyboard button with a link.
|
|
79
81
|
*
|
|
@@ -85,7 +87,10 @@ export declare function url(text: string, url: string): tl.RawKeyboardButtonUrl;
|
|
|
85
87
|
* Whether the user should verify their identity by entering 2FA password.
|
|
86
88
|
* See more: {@link tl.RawKeyboardButtonCallback#requiresPassword}
|
|
87
89
|
*/
|
|
88
|
-
export declare function callback(text: string, data: string | Uint8Array,
|
|
90
|
+
export declare function callback(text: string, data: string | Uint8Array, options?: {
|
|
91
|
+
requiresPassword?: boolean;
|
|
92
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
93
|
+
}): tl.RawKeyboardButtonCallback;
|
|
89
94
|
/**
|
|
90
95
|
* Button to force a user to switch to inline mode.
|
|
91
96
|
*
|
|
@@ -97,11 +102,19 @@ export declare function callback(text: string, data: string | Uint8Array, requir
|
|
|
97
102
|
*
|
|
98
103
|
* @param text Button text
|
|
99
104
|
* @param query Inline query (can be empty or omitted)
|
|
100
|
-
* @param currentChat
|
|
101
|
-
* If set, pressing the button will insert the bot's username
|
|
102
|
-
* and the specified inline query in the current chat's input field
|
|
103
105
|
*/
|
|
104
|
-
export declare function switchInline(text: string,
|
|
106
|
+
export declare function switchInline(text: string, options?: {
|
|
107
|
+
/**
|
|
108
|
+
* Inline query (can be empty or omitted)
|
|
109
|
+
*/
|
|
110
|
+
query?: string;
|
|
111
|
+
/**
|
|
112
|
+
* If set, pressing the button will insert the bot's username
|
|
113
|
+
* and the specified inline query in the current chat's input field
|
|
114
|
+
*/
|
|
115
|
+
currentChat?: boolean;
|
|
116
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
117
|
+
}): tl.RawKeyboardButtonSwitchInline;
|
|
105
118
|
/**
|
|
106
119
|
* Button to start a game
|
|
107
120
|
*
|
|
@@ -112,7 +125,9 @@ export declare function switchInline(text: string, query?: string, currentChat?:
|
|
|
112
125
|
* game is inferred from {@link InputMedia.game},
|
|
113
126
|
* thus this button should only be used with it.
|
|
114
127
|
*/
|
|
115
|
-
export declare function game(text: string
|
|
128
|
+
export declare function game(text: string, options?: {
|
|
129
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
130
|
+
}): tl.RawKeyboardButtonGame;
|
|
116
131
|
/**
|
|
117
132
|
* Button to pay for a product.
|
|
118
133
|
*
|
|
@@ -123,7 +138,9 @@ export declare function game(text: string): tl.RawKeyboardButtonGame;
|
|
|
123
138
|
* invoice is inferred from {@link InputMedia.invoice},
|
|
124
139
|
* thus this button should only be used with it.
|
|
125
140
|
*/
|
|
126
|
-
export declare function pay(text: string
|
|
141
|
+
export declare function pay(text: string, options?: {
|
|
142
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
143
|
+
}): tl.RawKeyboardButtonBuy;
|
|
127
144
|
/**
|
|
128
145
|
* Button to authorize a user
|
|
129
146
|
*
|
|
@@ -143,6 +160,7 @@ export declare function urlAuth(text: string, url: string, params?: {
|
|
|
143
160
|
* your bot to send messages to the user
|
|
144
161
|
*/
|
|
145
162
|
requestWriteAccess?: boolean;
|
|
163
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
146
164
|
/**
|
|
147
165
|
* Bot, which will be used for user authorization.
|
|
148
166
|
* `url` domain must be the same as the domain linked
|
|
@@ -160,14 +178,18 @@ export declare function urlAuth(text: string, url: string, params?: {
|
|
|
160
178
|
* @param text Button label
|
|
161
179
|
* @param url WebView URL
|
|
162
180
|
*/
|
|
163
|
-
export declare function webView(text: string, url: string
|
|
181
|
+
export declare function webView(text: string, url: string, options?: {
|
|
182
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
183
|
+
}): tl.RawKeyboardButtonWebView;
|
|
164
184
|
/**
|
|
165
185
|
* Button to open user profile
|
|
166
186
|
*
|
|
167
187
|
* @param text Text of the button
|
|
168
188
|
* @param user User to be opened (use {@link TelegramClient.resolvePeer})
|
|
169
189
|
*/
|
|
170
|
-
export declare function userProfile(text: string, user: tl.TypeInputPeer
|
|
190
|
+
export declare function userProfile(text: string, user: tl.TypeInputPeer, options?: {
|
|
191
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
192
|
+
}): tl.RawInputKeyboardButtonUserProfile;
|
|
171
193
|
/**
|
|
172
194
|
* Button to request a peer from the user
|
|
173
195
|
*
|
|
@@ -185,6 +207,7 @@ export declare function requestPeer(text: string, buttonId: number, params: {
|
|
|
185
207
|
* @default 1
|
|
186
208
|
*/
|
|
187
209
|
count?: number;
|
|
210
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
188
211
|
}): tl.RawKeyboardButtonRequestPeer;
|
|
189
212
|
/**
|
|
190
213
|
* Button to copy text to the user's clipboard
|
|
@@ -192,6 +215,7 @@ export declare function requestPeer(text: string, buttonId: number, params: {
|
|
|
192
215
|
export declare function copy(params: {
|
|
193
216
|
text: string;
|
|
194
217
|
copyText?: string;
|
|
218
|
+
style?: tl.RawKeyboardButtonStyle;
|
|
195
219
|
}): tl.RawKeyboardButtonCopy;
|
|
196
220
|
/**
|
|
197
221
|
* Find a button in the keyboard by its text or by predicate
|