@aracna/telegram-bot 2.0.1 → 2.0.4
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/apis/telegram-api.d.ts +7 -5
- package/apis/telegram-api.js +13 -4
- package/apis/telegram-file-api.d.ts +6 -4
- package/apis/telegram-file-api.js +12 -2
- package/classes/client.js +7 -7
- package/definitions/interfaces.d.ts +28 -13
- package/index.d.ts +169 -168
- package/package.json +2 -2
- package/requests/add-requests.d.ts +2 -1
- package/requests/add-requests.js +2 -2
- package/requests/answer-requests.d.ts +6 -5
- package/requests/answer-requests.js +10 -10
- package/requests/approve-requests.d.ts +2 -1
- package/requests/approve-requests.js +2 -2
- package/requests/ban-requests.d.ts +3 -2
- package/requests/ban-requests.js +4 -4
- package/requests/close-requests.d.ts +3 -2
- package/requests/close-requests.js +4 -4
- package/requests/copy-requests.d.ts +3 -2
- package/requests/copy-requests.js +4 -4
- package/requests/create-requests.d.ts +6 -5
- package/requests/create-requests.js +10 -10
- package/requests/decline-requests.d.ts +2 -1
- package/requests/decline-requests.js +2 -2
- package/requests/delete-requests.d.ts +9 -8
- package/requests/delete-requests.js +16 -16
- package/requests/download-requests.d.ts +3 -2
- package/requests/download-requests.js +6 -6
- package/requests/edit-requests.d.ts +10 -9
- package/requests/edit-requests.js +18 -18
- package/requests/export-requests.d.ts +2 -1
- package/requests/export-requests.js +2 -2
- package/requests/forward-requests.d.ts +3 -2
- package/requests/forward-requests.js +4 -4
- package/requests/get-requests.d.ts +22 -21
- package/requests/get-requests.js +42 -42
- package/requests/hide-requests.d.ts +2 -1
- package/requests/hide-requests.js +2 -2
- package/requests/leave-requests.d.ts +2 -1
- package/requests/leave-requests.js +2 -2
- package/requests/log-requests.d.ts +2 -1
- package/requests/log-requests.js +2 -2
- package/requests/pin-requests.d.ts +2 -1
- package/requests/pin-requests.js +2 -2
- package/requests/promote-requests.d.ts +2 -1
- package/requests/promote-requests.js +2 -2
- package/requests/refund-requests.d.ts +2 -1
- package/requests/refund-requests.js +2 -2
- package/requests/reopen-requests.d.ts +3 -2
- package/requests/reopen-requests.js +4 -4
- package/requests/replace-requests.d.ts +2 -1
- package/requests/replace-requests.js +2 -2
- package/requests/restrict-requests.d.ts +2 -1
- package/requests/restrict-requests.js +2 -2
- package/requests/revoke-requests.d.ts +2 -1
- package/requests/revoke-requests.js +2 -2
- package/requests/send-requests.d.ts +22 -22
- package/requests/send-requests.js +44 -44
- package/requests/set-requests.d.ts +23 -22
- package/requests/set-requests.js +44 -44
- package/requests/stop-requests.d.ts +3 -2
- package/requests/stop-requests.js +4 -4
- package/requests/unban-requests.d.ts +3 -2
- package/requests/unban-requests.js +4 -4
- package/requests/unhide-requests.d.ts +2 -1
- package/requests/unhide-requests.js +2 -2
- package/requests/unpin-requests.d.ts +5 -4
- package/requests/unpin-requests.js +8 -8
- package/requests/upload-requests.d.ts +2 -1
- package/requests/upload-requests.js +2 -2
- package/requests/webhook-requests.d.ts +5 -4
- package/requests/webhook-requests.js +8 -8
- package/utils/callback-query-utils.d.ts +1 -1
- package/utils/callback-query-utils.js +2 -2
- package/utils/inline-keyboard-utils.d.ts +1 -1
- package/utils/inline-keyboard-utils.js +2 -2
- package/utils/reply-to-message-utils.d.ts +3 -3
- package/utils/reply-to-message-utils.js +6 -6
- package/utils/start-message-utils.d.ts +4 -4
- package/utils/start-message-utils.js +8 -8
- package/definitions/telegram-api-definitions.d.ts +0 -12
- package/definitions/telegram-api-definitions.js +0 -2
package/requests/get-requests.js
CHANGED
|
@@ -23,70 +23,70 @@ exports.getUserChatBoosts = getUserChatBoosts;
|
|
|
23
23
|
exports.getUserProfilePhotos = getUserProfilePhotos;
|
|
24
24
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
25
25
|
const constants_1 = require("../definitions/constants");
|
|
26
|
-
async function getBusinessConnection(
|
|
27
|
-
return telegram_api_1.TelegramAPI.post('getBusinessConnection', body,
|
|
26
|
+
async function getBusinessConnection(body, config) {
|
|
27
|
+
return telegram_api_1.TelegramAPI.post('getBusinessConnection', body, config);
|
|
28
28
|
}
|
|
29
|
-
async function getChat(
|
|
30
|
-
return telegram_api_1.TelegramAPI.post('getChat', body,
|
|
29
|
+
async function getChat(body, config) {
|
|
30
|
+
return telegram_api_1.TelegramAPI.post('getChat', body, config);
|
|
31
31
|
}
|
|
32
|
-
async function getChatAdministrators(
|
|
33
|
-
return telegram_api_1.TelegramAPI.post('getChatAdministrators', body,
|
|
32
|
+
async function getChatAdministrators(body, config) {
|
|
33
|
+
return telegram_api_1.TelegramAPI.post('getChatAdministrators', body, config);
|
|
34
34
|
}
|
|
35
|
-
async function getChatMember(
|
|
36
|
-
return telegram_api_1.TelegramAPI.post('getChatMember', body,
|
|
35
|
+
async function getChatMember(body, config) {
|
|
36
|
+
return telegram_api_1.TelegramAPI.post('getChatMember', body, config);
|
|
37
37
|
}
|
|
38
|
-
async function getChatMemberCount(
|
|
39
|
-
return telegram_api_1.TelegramAPI.post('getChatMemberCount', body,
|
|
38
|
+
async function getChatMemberCount(body, config) {
|
|
39
|
+
return telegram_api_1.TelegramAPI.post('getChatMemberCount', body, config);
|
|
40
40
|
}
|
|
41
|
-
async function getChatMenuButton(
|
|
42
|
-
return telegram_api_1.TelegramAPI.post('getChatMenuButton', body,
|
|
41
|
+
async function getChatMenuButton(body, config) {
|
|
42
|
+
return telegram_api_1.TelegramAPI.post('getChatMenuButton', body, config);
|
|
43
43
|
}
|
|
44
|
-
async function getCustomEmojiStickers(
|
|
45
|
-
return telegram_api_1.TelegramAPI.post('getCustomEmojiStickers', body,
|
|
44
|
+
async function getCustomEmojiStickers(body, config) {
|
|
45
|
+
return telegram_api_1.TelegramAPI.post('getCustomEmojiStickers', body, config);
|
|
46
46
|
}
|
|
47
|
-
async function getFile(
|
|
48
|
-
return telegram_api_1.TelegramAPI.post('getFile', body,
|
|
47
|
+
async function getFile(body, config) {
|
|
48
|
+
return telegram_api_1.TelegramAPI.post('getFile', body, config);
|
|
49
49
|
}
|
|
50
|
-
async function getForumTopicIconStickers(
|
|
51
|
-
return telegram_api_1.TelegramAPI.post('getForumTopicIconStickers', undefined,
|
|
50
|
+
async function getForumTopicIconStickers(config) {
|
|
51
|
+
return telegram_api_1.TelegramAPI.post('getForumTopicIconStickers', undefined, config);
|
|
52
52
|
}
|
|
53
|
-
async function getGameHighScores(
|
|
54
|
-
return telegram_api_1.TelegramAPI.post('getGameHighScores', body,
|
|
53
|
+
async function getGameHighScores(body, config) {
|
|
54
|
+
return telegram_api_1.TelegramAPI.post('getGameHighScores', body, config);
|
|
55
55
|
}
|
|
56
|
-
async function getMe(
|
|
57
|
-
return telegram_api_1.TelegramAPI.post('getMe', undefined,
|
|
56
|
+
async function getMe(config) {
|
|
57
|
+
return telegram_api_1.TelegramAPI.post('getMe', undefined, config);
|
|
58
58
|
}
|
|
59
|
-
async function getMyCommands(
|
|
60
|
-
return telegram_api_1.TelegramAPI.post('getMyCommands', body,
|
|
59
|
+
async function getMyCommands(body, config) {
|
|
60
|
+
return telegram_api_1.TelegramAPI.post('getMyCommands', body, config);
|
|
61
61
|
}
|
|
62
|
-
async function getMyDefaultAdministratorRights(
|
|
63
|
-
return telegram_api_1.TelegramAPI.post('getMyDefaultAdministratorRights', body,
|
|
62
|
+
async function getMyDefaultAdministratorRights(body, config) {
|
|
63
|
+
return telegram_api_1.TelegramAPI.post('getMyDefaultAdministratorRights', body, config);
|
|
64
64
|
}
|
|
65
|
-
async function getMyDescription(
|
|
66
|
-
return telegram_api_1.TelegramAPI.post('getMyDescription', body,
|
|
65
|
+
async function getMyDescription(body, config) {
|
|
66
|
+
return telegram_api_1.TelegramAPI.post('getMyDescription', body, config);
|
|
67
67
|
}
|
|
68
|
-
async function getMyName(
|
|
69
|
-
return telegram_api_1.TelegramAPI.post('getMyName', body,
|
|
68
|
+
async function getMyName(body, config) {
|
|
69
|
+
return telegram_api_1.TelegramAPI.post('getMyName', body, config);
|
|
70
70
|
}
|
|
71
|
-
async function getMyShortDescription(
|
|
72
|
-
return telegram_api_1.TelegramAPI.post('getMyShortDescription', body,
|
|
71
|
+
async function getMyShortDescription(body, config) {
|
|
72
|
+
return telegram_api_1.TelegramAPI.post('getMyShortDescription', body, config);
|
|
73
73
|
}
|
|
74
|
-
async function getStarTransactions(
|
|
75
|
-
return telegram_api_1.TelegramAPI.post('getStarTransactions', body,
|
|
74
|
+
async function getStarTransactions(body, config) {
|
|
75
|
+
return telegram_api_1.TelegramAPI.post('getStarTransactions', body, config);
|
|
76
76
|
}
|
|
77
|
-
async function getStickerSet(
|
|
78
|
-
return telegram_api_1.TelegramAPI.post('getStickerSet', body,
|
|
77
|
+
async function getStickerSet(body, config) {
|
|
78
|
+
return telegram_api_1.TelegramAPI.post('getStickerSet', body, config);
|
|
79
79
|
}
|
|
80
|
-
async function getUpdates(
|
|
80
|
+
async function getUpdates(body, config) {
|
|
81
81
|
let updates;
|
|
82
|
-
updates = await telegram_api_1.TelegramAPI.post('getUpdates', { allowed_updates: constants_1.DEFAULT_ALLOWED_UPDATES, ...body },
|
|
82
|
+
updates = await telegram_api_1.TelegramAPI.post('getUpdates', { allowed_updates: constants_1.DEFAULT_ALLOWED_UPDATES, ...body }, config);
|
|
83
83
|
if (updates instanceof Error)
|
|
84
84
|
return updates;
|
|
85
85
|
return Array.isArray(updates) ? updates : [updates];
|
|
86
86
|
}
|
|
87
|
-
async function getUserChatBoosts(
|
|
88
|
-
return telegram_api_1.TelegramAPI.post('getUserChatBoosts', body,
|
|
87
|
+
async function getUserChatBoosts(body, config) {
|
|
88
|
+
return telegram_api_1.TelegramAPI.post('getUserChatBoosts', body, config);
|
|
89
89
|
}
|
|
90
|
-
async function getUserProfilePhotos(
|
|
91
|
-
return telegram_api_1.TelegramAPI.post('getUserProfilePhotos', body,
|
|
90
|
+
async function getUserProfilePhotos(body, config) {
|
|
91
|
+
return telegram_api_1.TelegramAPI.post('getUserProfilePhotos', body, config);
|
|
92
92
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { HideGeneralForumTopic } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function hideGeneralForumTopic(body: HideGeneralForumTopic, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hideGeneralForumTopic = hideGeneralForumTopic;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function hideGeneralForumTopic(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('hideGeneralForumTopic', body,
|
|
5
|
+
async function hideGeneralForumTopic(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('hideGeneralForumTopic', body, config);
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { LeaveChat } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function leaveChat(body: LeaveChat, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.leaveChat = leaveChat;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function leaveChat(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('leaveChat', body,
|
|
5
|
+
async function leaveChat(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('leaveChat', body, config);
|
|
7
7
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
|
-
|
|
2
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
3
|
+
export declare function logOut(config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
package/requests/log-requests.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logOut = logOut;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function logOut(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('logOut', undefined,
|
|
5
|
+
async function logOut(config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('logOut', undefined, config);
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { PinChatMessage } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function pinChatMessage(body: PinChatMessage, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
package/requests/pin-requests.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pinChatMessage = pinChatMessage;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function pinChatMessage(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('pinChatMessage', body,
|
|
5
|
+
async function pinChatMessage(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('pinChatMessage', body, config);
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { PromoteChatMember } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function promoteChatMember(body: PromoteChatMember, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.promoteChatMember = promoteChatMember;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function promoteChatMember(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('promoteChatMember', body,
|
|
5
|
+
async function promoteChatMember(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('promoteChatMember', body, config);
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { RefundStarPayment } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function refundStarPayment(body: RefundStarPayment, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.refundStarPayment = refundStarPayment;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function refundStarPayment(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('refundStarPayment', body,
|
|
5
|
+
async function refundStarPayment(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('refundStarPayment', body, config);
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { ReopenForumTopic, ReopenGeneralForumTopic } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function reopenForumTopic(body: ReopenForumTopic, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
5
|
+
export declare function reopenGeneralForumTopic(body: ReopenGeneralForumTopic, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.reopenForumTopic = reopenForumTopic;
|
|
4
4
|
exports.reopenGeneralForumTopic = reopenGeneralForumTopic;
|
|
5
5
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
6
|
-
async function reopenForumTopic(
|
|
7
|
-
return telegram_api_1.TelegramAPI.post('reopenForumTopic', body,
|
|
6
|
+
async function reopenForumTopic(body, config) {
|
|
7
|
+
return telegram_api_1.TelegramAPI.post('reopenForumTopic', body, config);
|
|
8
8
|
}
|
|
9
|
-
async function reopenGeneralForumTopic(
|
|
10
|
-
return telegram_api_1.TelegramAPI.post('reopenGeneralForumTopic', body,
|
|
9
|
+
async function reopenGeneralForumTopic(body, config) {
|
|
10
|
+
return telegram_api_1.TelegramAPI.post('reopenGeneralForumTopic', body, config);
|
|
11
11
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { ReplaceStickerInSet } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function replaceStickerInSet(body: ReplaceStickerInSet, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceStickerInSet = replaceStickerInSet;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function replaceStickerInSet(
|
|
5
|
+
async function replaceStickerInSet(body, config) {
|
|
6
6
|
return telegram_api_1.TelegramAPI.post('replaceStickerInSet', {
|
|
7
7
|
...body,
|
|
8
8
|
sticker: {
|
|
@@ -10,5 +10,5 @@ async function replaceStickerInSet(token, body) {
|
|
|
10
10
|
sticker: body.sticker.sticker instanceof Blob ? `attach://sticker_blob` : body.sticker.sticker
|
|
11
11
|
},
|
|
12
12
|
...(body.sticker.sticker instanceof Blob && { sticker_blob: body.sticker.sticker })
|
|
13
|
-
},
|
|
13
|
+
}, config);
|
|
14
14
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { RestrictChatMember } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function restrictChatMember(body: RestrictChatMember, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.restrictChatMember = restrictChatMember;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function restrictChatMember(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('restrictChatMember', body,
|
|
5
|
+
async function restrictChatMember(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('restrictChatMember', body, config);
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { ChatInviteLink, RevokeChatInviteLink } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function revokeChatInviteLink(body: RevokeChatInviteLink, config?: TelegramApiConfig): Promise<ChatInviteLink | FetchError>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.revokeChatInviteLink = revokeChatInviteLink;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function revokeChatInviteLink(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('revokeChatInviteLink', body,
|
|
5
|
+
async function revokeChatInviteLink(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('revokeChatInviteLink', body, config);
|
|
7
7
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { type FetchError } from '@aracna/core';
|
|
2
2
|
import type { Message, SendAnimation, SendAudio, SendChatAction, SendContact, SendDice, SendDocument, SendGame, SendInvoice, SendLocation, SendMessage, SendPhoto, SendPoll, SendSticker, SendVenue, SendVideo, SendVideoNote, SendVoice } from '@aracna/telegram-bot-types';
|
|
3
|
-
import type { SendMediaGroupAlternative, SendPaidMediaAlternative, SendRepliableMessage } from '../definitions/interfaces';
|
|
4
|
-
export declare function sendAnimation(
|
|
5
|
-
export declare function sendAudio(
|
|
6
|
-
export declare function sendDocument(
|
|
7
|
-
export declare function sendChatAction(
|
|
8
|
-
export declare function sendContact(
|
|
9
|
-
export declare function sendDice(
|
|
10
|
-
export declare function sendGame(
|
|
11
|
-
export declare function sendInvoice(
|
|
12
|
-
export declare function sendLocation(
|
|
13
|
-
export declare function sendMediaGroup(
|
|
14
|
-
export declare function sendMessage(
|
|
15
|
-
export declare function sendMessageHTML(
|
|
16
|
-
export declare function sendPaidMedia(
|
|
17
|
-
export declare function sendPhoto(
|
|
18
|
-
export declare function sendPoll(
|
|
19
|
-
export declare function sendRepliableMessage<T>(
|
|
20
|
-
export declare function sendSticker(
|
|
21
|
-
export declare function sendVenue(
|
|
22
|
-
export declare function sendVideo(
|
|
23
|
-
export declare function sendVideoNote(
|
|
24
|
-
export declare function sendVoice(
|
|
3
|
+
import type { SendMediaGroupAlternative, SendPaidMediaAlternative, SendRepliableMessage, TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function sendAnimation(body: SendAnimation, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
5
|
+
export declare function sendAudio(body: SendAudio, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
6
|
+
export declare function sendDocument(body: SendDocument, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
7
|
+
export declare function sendChatAction(body: SendChatAction, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
8
|
+
export declare function sendContact(body: SendContact, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
9
|
+
export declare function sendDice(body: SendDice, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
10
|
+
export declare function sendGame(body: SendGame, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
11
|
+
export declare function sendInvoice(body: SendInvoice, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
12
|
+
export declare function sendLocation(body: SendLocation, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
13
|
+
export declare function sendMediaGroup(body: SendMediaGroupAlternative, config?: TelegramApiConfig): Promise<Message[] | FetchError>;
|
|
14
|
+
export declare function sendMessage(body: SendMessage, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
15
|
+
export declare function sendMessageHTML(body: SendMessage, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
16
|
+
export declare function sendPaidMedia(body: SendPaidMediaAlternative, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
17
|
+
export declare function sendPhoto(body: SendPhoto, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
18
|
+
export declare function sendPoll(body: SendPoll, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
19
|
+
export declare function sendRepliableMessage<T>(body: SendRepliableMessage<T>, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
20
|
+
export declare function sendSticker(body: SendSticker, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
21
|
+
export declare function sendVenue(body: SendVenue, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
22
|
+
export declare function sendVideo(body: SendVideo, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
23
|
+
export declare function sendVideoNote(body: SendVideoNote, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
24
|
+
export declare function sendVoice(body: SendVoice, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
@@ -24,79 +24,79 @@ exports.sendVoice = sendVoice;
|
|
|
24
24
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
25
25
|
const html_utils_1 = require("../utils/html-utils");
|
|
26
26
|
const reply_to_message_utils_1 = require("../utils/reply-to-message-utils");
|
|
27
|
-
async function sendAnimation(
|
|
28
|
-
return telegram_api_1.TelegramAPI.post('sendAnimation', body,
|
|
27
|
+
async function sendAnimation(body, config) {
|
|
28
|
+
return telegram_api_1.TelegramAPI.post('sendAnimation', body, config);
|
|
29
29
|
}
|
|
30
|
-
async function sendAudio(
|
|
31
|
-
return telegram_api_1.TelegramAPI.post('sendAudio', body,
|
|
30
|
+
async function sendAudio(body, config) {
|
|
31
|
+
return telegram_api_1.TelegramAPI.post('sendAudio', body, config);
|
|
32
32
|
}
|
|
33
|
-
async function sendDocument(
|
|
34
|
-
return telegram_api_1.TelegramAPI.post('sendDocument', body,
|
|
33
|
+
async function sendDocument(body, config) {
|
|
34
|
+
return telegram_api_1.TelegramAPI.post('sendDocument', body, config);
|
|
35
35
|
}
|
|
36
|
-
async function sendChatAction(
|
|
37
|
-
return telegram_api_1.TelegramAPI.post('sendChatAction', body,
|
|
36
|
+
async function sendChatAction(body, config) {
|
|
37
|
+
return telegram_api_1.TelegramAPI.post('sendChatAction', body, config);
|
|
38
38
|
}
|
|
39
|
-
async function sendContact(
|
|
40
|
-
return telegram_api_1.TelegramAPI.post('sendContact', body,
|
|
39
|
+
async function sendContact(body, config) {
|
|
40
|
+
return telegram_api_1.TelegramAPI.post('sendContact', body, config);
|
|
41
41
|
}
|
|
42
|
-
async function sendDice(
|
|
43
|
-
return telegram_api_1.TelegramAPI.post('sendDice', body,
|
|
42
|
+
async function sendDice(body, config) {
|
|
43
|
+
return telegram_api_1.TelegramAPI.post('sendDice', body, config);
|
|
44
44
|
}
|
|
45
|
-
async function sendGame(
|
|
46
|
-
return telegram_api_1.TelegramAPI.post('sendGame', body,
|
|
45
|
+
async function sendGame(body, config) {
|
|
46
|
+
return telegram_api_1.TelegramAPI.post('sendGame', body, config);
|
|
47
47
|
}
|
|
48
|
-
async function sendInvoice(
|
|
49
|
-
return telegram_api_1.TelegramAPI.post('sendInvoice', body,
|
|
48
|
+
async function sendInvoice(body, config) {
|
|
49
|
+
return telegram_api_1.TelegramAPI.post('sendInvoice', body, config);
|
|
50
50
|
}
|
|
51
|
-
async function sendLocation(
|
|
52
|
-
return telegram_api_1.TelegramAPI.post('sendLocation', body,
|
|
51
|
+
async function sendLocation(body, config) {
|
|
52
|
+
return telegram_api_1.TelegramAPI.post('sendLocation', body, config);
|
|
53
53
|
}
|
|
54
|
-
async function sendMediaGroup(
|
|
54
|
+
async function sendMediaGroup(body, config) {
|
|
55
55
|
return telegram_api_1.TelegramAPI.post('sendMediaGroup', {
|
|
56
56
|
...body,
|
|
57
57
|
media: body.media.map((media, index) => ({ ...media, media: `attach://media_${index}` })),
|
|
58
58
|
...body.media.reduce((result, media, index) => ({ ...result, [`media_${index}`]: media.media }), {})
|
|
59
|
-
},
|
|
59
|
+
}, config);
|
|
60
60
|
}
|
|
61
|
-
async function sendMessage(
|
|
62
|
-
return telegram_api_1.TelegramAPI.post('sendMessage', body,
|
|
61
|
+
async function sendMessage(body, config) {
|
|
62
|
+
return telegram_api_1.TelegramAPI.post('sendMessage', body, config);
|
|
63
63
|
}
|
|
64
|
-
async function sendMessageHTML(
|
|
65
|
-
return sendMessage(
|
|
64
|
+
async function sendMessageHTML(body, config) {
|
|
65
|
+
return sendMessage({ parse_mode: 'HTML', ...body, text: (0, html_utils_1.sanitizeHTML)(body.text) }, config);
|
|
66
66
|
}
|
|
67
|
-
async function sendPaidMedia(
|
|
67
|
+
async function sendPaidMedia(body, config) {
|
|
68
68
|
return telegram_api_1.TelegramAPI.post('sendPaidMedia', {
|
|
69
69
|
...body,
|
|
70
70
|
media: body.media.map((v, k) => ({ ...v, media: `attach://media_${k}` })),
|
|
71
71
|
...body.media.reduce((r, v, k) => ({ ...r, [`media_${k}`]: v.media }), {})
|
|
72
|
-
},
|
|
72
|
+
}, config);
|
|
73
73
|
}
|
|
74
|
-
async function sendPhoto(
|
|
75
|
-
return telegram_api_1.TelegramAPI.post('sendPhoto', body,
|
|
74
|
+
async function sendPhoto(body, config) {
|
|
75
|
+
return telegram_api_1.TelegramAPI.post('sendPhoto', body, config);
|
|
76
76
|
}
|
|
77
|
-
async function sendPoll(
|
|
78
|
-
return telegram_api_1.TelegramAPI.post('sendPoll', body,
|
|
77
|
+
async function sendPoll(body, config) {
|
|
78
|
+
return telegram_api_1.TelegramAPI.post('sendPoll', body, config);
|
|
79
79
|
}
|
|
80
|
-
async function sendRepliableMessage(
|
|
81
|
-
return sendMessage(
|
|
80
|
+
async function sendRepliableMessage(body, config) {
|
|
81
|
+
return sendMessage({
|
|
82
82
|
parse_mode: 'HTML',
|
|
83
83
|
reply_markup: { force_reply: true, selective: true },
|
|
84
84
|
...body,
|
|
85
|
-
text: body.text + (0, reply_to_message_utils_1.
|
|
86
|
-
});
|
|
85
|
+
text: body.text + (0, reply_to_message_utils_1.encodeReplyToMessageBodyToAnchorTag)({ chatID: body.from_chat_id, command: body.command, data: body.data })
|
|
86
|
+
}, config);
|
|
87
87
|
}
|
|
88
|
-
async function sendSticker(
|
|
89
|
-
return telegram_api_1.TelegramAPI.post('sendSticker', body,
|
|
88
|
+
async function sendSticker(body, config) {
|
|
89
|
+
return telegram_api_1.TelegramAPI.post('sendSticker', body, config);
|
|
90
90
|
}
|
|
91
|
-
async function sendVenue(
|
|
92
|
-
return telegram_api_1.TelegramAPI.post('sendVenue', body,
|
|
91
|
+
async function sendVenue(body, config) {
|
|
92
|
+
return telegram_api_1.TelegramAPI.post('sendVenue', body, config);
|
|
93
93
|
}
|
|
94
|
-
async function sendVideo(
|
|
95
|
-
return telegram_api_1.TelegramAPI.post('sendVideo', body,
|
|
94
|
+
async function sendVideo(body, config) {
|
|
95
|
+
return telegram_api_1.TelegramAPI.post('sendVideo', body, config);
|
|
96
96
|
}
|
|
97
|
-
async function sendVideoNote(
|
|
98
|
-
return telegram_api_1.TelegramAPI.post('sendVideoNote', body,
|
|
97
|
+
async function sendVideoNote(body, config) {
|
|
98
|
+
return telegram_api_1.TelegramAPI.post('sendVideoNote', body, config);
|
|
99
99
|
}
|
|
100
|
-
async function sendVoice(
|
|
101
|
-
return telegram_api_1.TelegramAPI.post('sendVoice', body,
|
|
100
|
+
async function sendVoice(body, config) {
|
|
101
|
+
return telegram_api_1.TelegramAPI.post('sendVoice', body, config);
|
|
102
102
|
}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { SetChatAdministratorCustomTitle, SetChatDescription, SetChatMenuButton, SetChatPermissions, SetChatPhoto, SetChatStickerSet, SetChatTitle, SetCustomEmojiStickerSetThumbnail, SetGameScore, SetMessageReaction, SetMyCommands, SetMyDefaultAdministratorRights, SetMyDescription, SetMyName, SetMyShortDescription, SetPassportDataErrors, SetStickerEmojiList, SetStickerKeywords, SetStickerMaskPosition, SetStickerPositionInSet, SetStickerSetThumbnail, SetStickerSetTitle } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
24
|
-
export declare function
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function setChatAdministratorCustomTitle(body: SetChatAdministratorCustomTitle, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
5
|
+
export declare function setChatDescription(body: SetChatDescription, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
6
|
+
export declare function setChatMenuButton(body: SetChatMenuButton, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
7
|
+
export declare function setChatPermissions(body: SetChatPermissions, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
8
|
+
export declare function setChatPhoto(body: SetChatPhoto, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
9
|
+
export declare function setChatStickerSet(body: SetChatStickerSet, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
10
|
+
export declare function setChatTitle(body: SetChatTitle, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
11
|
+
export declare function setCustomEmojiStickerSetThumbnail(body: SetCustomEmojiStickerSetThumbnail, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
12
|
+
export declare function setGameScore(body: SetGameScore, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
13
|
+
export declare function setMessageReaction(body: SetMessageReaction, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
14
|
+
export declare function setMyCommands(body: SetMyCommands, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
15
|
+
export declare function setMyDefaultAdministratorRights(body: SetMyDefaultAdministratorRights, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
16
|
+
export declare function setMyDescription(body: SetMyDescription, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
17
|
+
export declare function setMyName(body: SetMyName, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
18
|
+
export declare function setMyShortDescription(body: SetMyShortDescription, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
19
|
+
export declare function setPassportDataErrors(body: SetPassportDataErrors, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
20
|
+
export declare function setStickerEmojiList(body: SetStickerEmojiList, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
21
|
+
export declare function setStickerKeywords(body: SetStickerKeywords, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
22
|
+
export declare function setStickerMaskPosition(body: SetStickerMaskPosition, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
23
|
+
export declare function setStickerPositionInSet(body: SetStickerPositionInSet, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
24
|
+
export declare function setStickerSetThumbnail(body: SetStickerSetThumbnail, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
25
|
+
export declare function setStickerSetTitle(body: SetStickerSetTitle, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|