@aracna/telegram-bot 2.0.3 → 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 +12 -0
- package/index.d.ts +150 -152
- 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/reply-to-message-utils.d.ts +3 -3
- package/utils/reply-to-message-utils.js +1 -1
- package/utils/start-message-utils.d.ts +3 -3
- package/definitions/telegram-api-definitions.d.ts +0 -12
- package/definitions/telegram-api-definitions.js +0 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { AnswerCallbackQuery, AnswerInlineQuery, AnswerPreCheckoutQuery, AnswerShippingQuery, AnswerWebAppQuery, SentWebAppMessage } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function answerCallbackQuery(body: AnswerCallbackQuery, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
5
|
+
export declare function answerInlineQuery(body: AnswerInlineQuery, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
6
|
+
export declare function answerPreCheckoutQuery(body: AnswerPreCheckoutQuery, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
7
|
+
export declare function answerShippingQuery(body: AnswerShippingQuery, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
8
|
+
export declare function answerWebAppQuery(body: AnswerWebAppQuery, config?: TelegramApiConfig): Promise<SentWebAppMessage | FetchError>;
|
|
@@ -6,18 +6,18 @@ exports.answerPreCheckoutQuery = answerPreCheckoutQuery;
|
|
|
6
6
|
exports.answerShippingQuery = answerShippingQuery;
|
|
7
7
|
exports.answerWebAppQuery = answerWebAppQuery;
|
|
8
8
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
9
|
-
async function answerCallbackQuery(
|
|
10
|
-
return telegram_api_1.TelegramAPI.post('answerCallbackQuery', body,
|
|
9
|
+
async function answerCallbackQuery(body, config) {
|
|
10
|
+
return telegram_api_1.TelegramAPI.post('answerCallbackQuery', body, config);
|
|
11
11
|
}
|
|
12
|
-
async function answerInlineQuery(
|
|
13
|
-
return telegram_api_1.TelegramAPI.post('answerInlineQuery', body,
|
|
12
|
+
async function answerInlineQuery(body, config) {
|
|
13
|
+
return telegram_api_1.TelegramAPI.post('answerInlineQuery', body, config);
|
|
14
14
|
}
|
|
15
|
-
async function answerPreCheckoutQuery(
|
|
16
|
-
return telegram_api_1.TelegramAPI.post('answerPreCheckoutQuery', body,
|
|
15
|
+
async function answerPreCheckoutQuery(body, config) {
|
|
16
|
+
return telegram_api_1.TelegramAPI.post('answerPreCheckoutQuery', body, config);
|
|
17
17
|
}
|
|
18
|
-
async function answerShippingQuery(
|
|
19
|
-
return telegram_api_1.TelegramAPI.post('answerShippingQuery', body,
|
|
18
|
+
async function answerShippingQuery(body, config) {
|
|
19
|
+
return telegram_api_1.TelegramAPI.post('answerShippingQuery', body, config);
|
|
20
20
|
}
|
|
21
|
-
async function answerWebAppQuery(
|
|
22
|
-
return telegram_api_1.TelegramAPI.post('answerWebAppQuery', body,
|
|
21
|
+
async function answerWebAppQuery(body, config) {
|
|
22
|
+
return telegram_api_1.TelegramAPI.post('answerWebAppQuery', body, config);
|
|
23
23
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { ApproveChatJoinRequest } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function approveChatJoinRequest(body: ApproveChatJoinRequest, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.approveChatJoinRequest = approveChatJoinRequest;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function approveChatJoinRequest(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('approveChatJoinRequest', body,
|
|
5
|
+
async function approveChatJoinRequest(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('approveChatJoinRequest', body, config);
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { BanChatMember, BanChatSenderChat } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function banChatMember(body: BanChatMember, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
5
|
+
export declare function banChatSenderChat(body: BanChatSenderChat, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
package/requests/ban-requests.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.banChatMember = banChatMember;
|
|
4
4
|
exports.banChatSenderChat = banChatSenderChat;
|
|
5
5
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
6
|
-
async function banChatMember(
|
|
7
|
-
return telegram_api_1.TelegramAPI.post('banChatMember', body,
|
|
6
|
+
async function banChatMember(body, config) {
|
|
7
|
+
return telegram_api_1.TelegramAPI.post('banChatMember', body, config);
|
|
8
8
|
}
|
|
9
|
-
async function banChatSenderChat(
|
|
10
|
-
return telegram_api_1.TelegramAPI.post('banChatSenderChat', body,
|
|
9
|
+
async function banChatSenderChat(body, config) {
|
|
10
|
+
return telegram_api_1.TelegramAPI.post('banChatSenderChat', body, config);
|
|
11
11
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { CloseForumTopic, CloseGeneralForumTopic } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function closeForumTopic(body: CloseForumTopic, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
5
|
+
export declare function closeGeneralForumTopic(body: CloseGeneralForumTopic, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.closeForumTopic = closeForumTopic;
|
|
4
4
|
exports.closeGeneralForumTopic = closeGeneralForumTopic;
|
|
5
5
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
6
|
-
async function closeForumTopic(
|
|
7
|
-
return telegram_api_1.TelegramAPI.post('closeForumTopic', body,
|
|
6
|
+
async function closeForumTopic(body, config) {
|
|
7
|
+
return telegram_api_1.TelegramAPI.post('closeForumTopic', body, config);
|
|
8
8
|
}
|
|
9
|
-
async function closeGeneralForumTopic(
|
|
10
|
-
return telegram_api_1.TelegramAPI.post('closeGeneralForumTopic', body,
|
|
9
|
+
async function closeGeneralForumTopic(body, config) {
|
|
10
|
+
return telegram_api_1.TelegramAPI.post('closeGeneralForumTopic', body, config);
|
|
11
11
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { CopyMessage, CopyMessages, MessageId } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function copyMessage(body: CopyMessage, config?: TelegramApiConfig): Promise<MessageId | FetchError>;
|
|
5
|
+
export declare function copyMessages(body: CopyMessages, config?: TelegramApiConfig): Promise<MessageId[] | FetchError>;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.copyMessage = copyMessage;
|
|
4
4
|
exports.copyMessages = copyMessages;
|
|
5
5
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
6
|
-
async function copyMessage(
|
|
7
|
-
return telegram_api_1.TelegramAPI.post('copyMessage', body,
|
|
6
|
+
async function copyMessage(body, config) {
|
|
7
|
+
return telegram_api_1.TelegramAPI.post('copyMessage', body, config);
|
|
8
8
|
}
|
|
9
|
-
async function copyMessages(
|
|
10
|
-
return telegram_api_1.TelegramAPI.post('copyMessages', body,
|
|
9
|
+
async function copyMessages(body, config) {
|
|
10
|
+
return telegram_api_1.TelegramAPI.post('copyMessages', body, config);
|
|
11
11
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { ChatInviteLink, CreateChatInviteLink, CreateChatSubscriptionInviteLink, CreateForumTopic, CreateInvoiceLink, CreateNewStickerSet, ForumTopic } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function createChatInviteLink(body: CreateChatInviteLink, config?: TelegramApiConfig): Promise<ChatInviteLink | FetchError>;
|
|
5
|
+
export declare function createChatSubscriptionInviteLink(body: CreateChatSubscriptionInviteLink, config?: TelegramApiConfig): Promise<ChatInviteLink | FetchError>;
|
|
6
|
+
export declare function createForumTopic(body: CreateForumTopic, config?: TelegramApiConfig): Promise<ForumTopic | FetchError>;
|
|
7
|
+
export declare function createInvoiceLink(body: CreateInvoiceLink, config?: TelegramApiConfig): Promise<string | FetchError>;
|
|
8
|
+
export declare function createNewStickerSet(body: CreateNewStickerSet, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -6,19 +6,19 @@ exports.createForumTopic = createForumTopic;
|
|
|
6
6
|
exports.createInvoiceLink = createInvoiceLink;
|
|
7
7
|
exports.createNewStickerSet = createNewStickerSet;
|
|
8
8
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
9
|
-
async function createChatInviteLink(
|
|
10
|
-
return telegram_api_1.TelegramAPI.post('createChatInviteLink', body,
|
|
9
|
+
async function createChatInviteLink(body, config) {
|
|
10
|
+
return telegram_api_1.TelegramAPI.post('createChatInviteLink', body, config);
|
|
11
11
|
}
|
|
12
|
-
async function createChatSubscriptionInviteLink(
|
|
13
|
-
return telegram_api_1.TelegramAPI.post('createChatSubscriptionInviteLink', body,
|
|
12
|
+
async function createChatSubscriptionInviteLink(body, config) {
|
|
13
|
+
return telegram_api_1.TelegramAPI.post('createChatSubscriptionInviteLink', body, config);
|
|
14
14
|
}
|
|
15
|
-
async function createForumTopic(
|
|
16
|
-
return telegram_api_1.TelegramAPI.post('createForumTopic', body,
|
|
15
|
+
async function createForumTopic(body, config) {
|
|
16
|
+
return telegram_api_1.TelegramAPI.post('createForumTopic', body, config);
|
|
17
17
|
}
|
|
18
|
-
async function createInvoiceLink(
|
|
19
|
-
return telegram_api_1.TelegramAPI.post('createInvoiceLink', body,
|
|
18
|
+
async function createInvoiceLink(body, config) {
|
|
19
|
+
return telegram_api_1.TelegramAPI.post('createInvoiceLink', body, config);
|
|
20
20
|
}
|
|
21
|
-
async function createNewStickerSet(
|
|
21
|
+
async function createNewStickerSet(body, config) {
|
|
22
22
|
return telegram_api_1.TelegramAPI.post('createNewStickerSet', {
|
|
23
23
|
...body,
|
|
24
24
|
stickers: body.stickers.map((sticker, index) => ({
|
|
@@ -26,5 +26,5 @@ async function createNewStickerSet(token, body) {
|
|
|
26
26
|
sticker: sticker.sticker instanceof Blob ? `attach://sticker_${index}` : sticker.sticker
|
|
27
27
|
})),
|
|
28
28
|
...body.stickers.reduce((result, sticker, index) => ({ ...result, [`sticker_${index}`]: sticker.sticker }), {})
|
|
29
|
-
},
|
|
29
|
+
}, config);
|
|
30
30
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { DeclineChatJoinRequest } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function declineChatJoinRequest(body: DeclineChatJoinRequest, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.declineChatJoinRequest = declineChatJoinRequest;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function declineChatJoinRequest(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('declineChatJoinRequest', body,
|
|
5
|
+
async function declineChatJoinRequest(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('declineChatJoinRequest', body, config);
|
|
7
7
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { DeleteChatPhoto, DeleteChatStickerSet, DeleteForumTopic, DeleteMessage, DeleteMessages, DeleteMyCommands, DeleteStickerFromSet, DeleteStickerSet } 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
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function deleteChatPhoto(body: DeleteChatPhoto, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
5
|
+
export declare function deleteChatStickerSet(body: DeleteChatStickerSet, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
6
|
+
export declare function deleteForumTopic(body: DeleteForumTopic, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
7
|
+
export declare function deleteMessage(body: DeleteMessage, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
8
|
+
export declare function deleteMessages(body: DeleteMessages, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
9
|
+
export declare function deleteMyCommands(body?: DeleteMyCommands, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
10
|
+
export declare function deleteStickerFromSet(body: DeleteStickerFromSet, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
11
|
+
export declare function deleteStickerSet(body: DeleteStickerSet, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
@@ -9,27 +9,27 @@ exports.deleteMyCommands = deleteMyCommands;
|
|
|
9
9
|
exports.deleteStickerFromSet = deleteStickerFromSet;
|
|
10
10
|
exports.deleteStickerSet = deleteStickerSet;
|
|
11
11
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
12
|
-
async function deleteChatPhoto(
|
|
13
|
-
return telegram_api_1.TelegramAPI.post('deleteChatPhoto', body,
|
|
12
|
+
async function deleteChatPhoto(body, config) {
|
|
13
|
+
return telegram_api_1.TelegramAPI.post('deleteChatPhoto', body, config);
|
|
14
14
|
}
|
|
15
|
-
async function deleteChatStickerSet(
|
|
16
|
-
return telegram_api_1.TelegramAPI.post('deleteChatStickerSet', body,
|
|
15
|
+
async function deleteChatStickerSet(body, config) {
|
|
16
|
+
return telegram_api_1.TelegramAPI.post('deleteChatStickerSet', body, config);
|
|
17
17
|
}
|
|
18
|
-
async function deleteForumTopic(
|
|
19
|
-
return telegram_api_1.TelegramAPI.post('deleteForumTopic', body,
|
|
18
|
+
async function deleteForumTopic(body, config) {
|
|
19
|
+
return telegram_api_1.TelegramAPI.post('deleteForumTopic', body, config);
|
|
20
20
|
}
|
|
21
|
-
async function deleteMessage(
|
|
22
|
-
return telegram_api_1.TelegramAPI.post('deleteMessage', body,
|
|
21
|
+
async function deleteMessage(body, config) {
|
|
22
|
+
return telegram_api_1.TelegramAPI.post('deleteMessage', body, config);
|
|
23
23
|
}
|
|
24
|
-
async function deleteMessages(
|
|
25
|
-
return telegram_api_1.TelegramAPI.post('deleteMessages', body,
|
|
24
|
+
async function deleteMessages(body, config) {
|
|
25
|
+
return telegram_api_1.TelegramAPI.post('deleteMessages', body, config);
|
|
26
26
|
}
|
|
27
|
-
async function deleteMyCommands(
|
|
28
|
-
return telegram_api_1.TelegramAPI.post('deleteMyCommands', body,
|
|
27
|
+
async function deleteMyCommands(body, config) {
|
|
28
|
+
return telegram_api_1.TelegramAPI.post('deleteMyCommands', body, config);
|
|
29
29
|
}
|
|
30
|
-
async function deleteStickerFromSet(
|
|
31
|
-
return telegram_api_1.TelegramAPI.post('deleteStickerFromSet', body,
|
|
30
|
+
async function deleteStickerFromSet(body, config) {
|
|
31
|
+
return telegram_api_1.TelegramAPI.post('deleteStickerFromSet', body, config);
|
|
32
32
|
}
|
|
33
|
-
async function deleteStickerSet(
|
|
34
|
-
return telegram_api_1.TelegramAPI.post('deleteStickerSet', body,
|
|
33
|
+
async function deleteStickerSet(body, config) {
|
|
34
|
+
return telegram_api_1.TelegramAPI.post('deleteStickerSet', body, config);
|
|
35
35
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
2
|
+
import type { TelegramApiConfig, TelegramFileApiConfig } from '../definitions/interfaces';
|
|
3
|
+
export declare function downloadFile(fileID: string, config?: TelegramApiConfig & TelegramFileApiConfig): Promise<Blob | FetchError>;
|
|
4
|
+
export declare function downloadUserFirstProfilePhoto(userID: bigint | number, config?: TelegramApiConfig & TelegramFileApiConfig): Promise<Blob | FetchError | Error>;
|
|
@@ -4,25 +4,25 @@ exports.downloadFile = downloadFile;
|
|
|
4
4
|
exports.downloadUserFirstProfilePhoto = downloadUserFirstProfilePhoto;
|
|
5
5
|
const telegram_file_api_1 = require("../apis/telegram-file-api");
|
|
6
6
|
const get_requests_1 = require("./get-requests");
|
|
7
|
-
async function downloadFile(
|
|
7
|
+
async function downloadFile(fileID, config) {
|
|
8
8
|
let file, blob;
|
|
9
|
-
file = await (0, get_requests_1.getFile)(
|
|
9
|
+
file = await (0, get_requests_1.getFile)({ file_id: fileID }, config);
|
|
10
10
|
if (file instanceof Error)
|
|
11
11
|
return file;
|
|
12
|
-
blob = await telegram_file_api_1.TelegramFileAPI.get(file.file_path ?? '',
|
|
12
|
+
blob = await telegram_file_api_1.TelegramFileAPI.get(file.file_path ?? '', config);
|
|
13
13
|
if (blob instanceof Error)
|
|
14
14
|
return blob;
|
|
15
15
|
return blob;
|
|
16
16
|
}
|
|
17
|
-
async function downloadUserFirstProfilePhoto(
|
|
17
|
+
async function downloadUserFirstProfilePhoto(userID, config) {
|
|
18
18
|
let photos, sizes, blob;
|
|
19
|
-
photos = await (0, get_requests_1.getUserProfilePhotos)(
|
|
19
|
+
photos = await (0, get_requests_1.getUserProfilePhotos)({ limit: 1, user_id: userID }, config);
|
|
20
20
|
if (photos instanceof Error)
|
|
21
21
|
return photos;
|
|
22
22
|
sizes = photos.photos;
|
|
23
23
|
if (sizes.length <= 0)
|
|
24
24
|
return new Error(JSON.stringify(photos));
|
|
25
|
-
blob = await downloadFile(
|
|
25
|
+
blob = await downloadFile(sizes[0].reduce((r, v) => (v.height + v.width > r.height + r.width ? v : r), sizes[0][0]).file_id, config);
|
|
26
26
|
if (blob instanceof Error)
|
|
27
27
|
return blob;
|
|
28
28
|
return blob;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { ChatInviteLink, EditChatInviteLink, EditChatSubscriptionInviteLink, EditForumTopic, EditGeneralForumTopic, EditMessageCaption, EditMessageLiveLocation, EditMessageReplyMarkup, EditMessageText, Message } from '@aracna/telegram-bot-types';
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
3
4
|
import { EditMessageMediaAlternative } from '../definitions/interfaces';
|
|
4
|
-
export declare function editChatInviteLink(
|
|
5
|
-
export declare function editChatSubscriptionInviteLink(
|
|
6
|
-
export declare function editForumTopic(
|
|
7
|
-
export declare function editGeneralForumTopic(
|
|
8
|
-
export declare function editMessageCaption(
|
|
9
|
-
export declare function editMessageLiveLocation(
|
|
10
|
-
export declare function editMessageMedia(
|
|
11
|
-
export declare function editMessageReplyMarkup(
|
|
12
|
-
export declare function editMessageText(
|
|
5
|
+
export declare function editChatInviteLink(body: EditChatInviteLink, config?: TelegramApiConfig): Promise<ChatInviteLink | FetchError>;
|
|
6
|
+
export declare function editChatSubscriptionInviteLink(body: EditChatSubscriptionInviteLink, config?: TelegramApiConfig): Promise<ChatInviteLink | FetchError>;
|
|
7
|
+
export declare function editForumTopic(body: EditForumTopic, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
8
|
+
export declare function editGeneralForumTopic(body: EditGeneralForumTopic, config?: TelegramApiConfig): Promise<boolean | FetchError>;
|
|
9
|
+
export declare function editMessageCaption(body: EditMessageCaption, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
10
|
+
export declare function editMessageLiveLocation(body: EditMessageLiveLocation, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
11
|
+
export declare function editMessageMedia(body: EditMessageMediaAlternative, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
12
|
+
export declare function editMessageReplyMarkup(body: EditMessageReplyMarkup, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
13
|
+
export declare function editMessageText(body: EditMessageText, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
@@ -10,25 +10,25 @@ exports.editMessageMedia = editMessageMedia;
|
|
|
10
10
|
exports.editMessageReplyMarkup = editMessageReplyMarkup;
|
|
11
11
|
exports.editMessageText = editMessageText;
|
|
12
12
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
13
|
-
async function editChatInviteLink(
|
|
14
|
-
return telegram_api_1.TelegramAPI.post('editChatInviteLink', body,
|
|
13
|
+
async function editChatInviteLink(body, config) {
|
|
14
|
+
return telegram_api_1.TelegramAPI.post('editChatInviteLink', body, config);
|
|
15
15
|
}
|
|
16
|
-
async function editChatSubscriptionInviteLink(
|
|
17
|
-
return telegram_api_1.TelegramAPI.post('editChatSubscriptionInviteLink', body,
|
|
16
|
+
async function editChatSubscriptionInviteLink(body, config) {
|
|
17
|
+
return telegram_api_1.TelegramAPI.post('editChatSubscriptionInviteLink', body, config);
|
|
18
18
|
}
|
|
19
|
-
async function editForumTopic(
|
|
20
|
-
return telegram_api_1.TelegramAPI.post('editForumTopic', body,
|
|
19
|
+
async function editForumTopic(body, config) {
|
|
20
|
+
return telegram_api_1.TelegramAPI.post('editForumTopic', body, config);
|
|
21
21
|
}
|
|
22
|
-
async function editGeneralForumTopic(
|
|
23
|
-
return telegram_api_1.TelegramAPI.post('editGeneralForumTopic', body,
|
|
22
|
+
async function editGeneralForumTopic(body, config) {
|
|
23
|
+
return telegram_api_1.TelegramAPI.post('editGeneralForumTopic', body, config);
|
|
24
24
|
}
|
|
25
|
-
async function editMessageCaption(
|
|
26
|
-
return telegram_api_1.TelegramAPI.post('editMessageCaption', body,
|
|
25
|
+
async function editMessageCaption(body, config) {
|
|
26
|
+
return telegram_api_1.TelegramAPI.post('editMessageCaption', body, config);
|
|
27
27
|
}
|
|
28
|
-
async function editMessageLiveLocation(
|
|
29
|
-
return telegram_api_1.TelegramAPI.post('editMessageLiveLocation', body,
|
|
28
|
+
async function editMessageLiveLocation(body, config) {
|
|
29
|
+
return telegram_api_1.TelegramAPI.post('editMessageLiveLocation', body, config);
|
|
30
30
|
}
|
|
31
|
-
async function editMessageMedia(
|
|
31
|
+
async function editMessageMedia(body, config) {
|
|
32
32
|
return telegram_api_1.TelegramAPI.post('editMessageMedia', {
|
|
33
33
|
...body,
|
|
34
34
|
media: {
|
|
@@ -36,11 +36,11 @@ async function editMessageMedia(token, body) {
|
|
|
36
36
|
media: body.media.media instanceof Blob ? `attach://media_blob` : body.media.media
|
|
37
37
|
},
|
|
38
38
|
...(body.media.media instanceof Blob ? { media_blob: body.media.media } : {})
|
|
39
|
-
},
|
|
39
|
+
}, config);
|
|
40
40
|
}
|
|
41
|
-
async function editMessageReplyMarkup(
|
|
42
|
-
return telegram_api_1.TelegramAPI.post('editMessageReplyMarkup', body,
|
|
41
|
+
async function editMessageReplyMarkup(body, config) {
|
|
42
|
+
return telegram_api_1.TelegramAPI.post('editMessageReplyMarkup', body, config);
|
|
43
43
|
}
|
|
44
|
-
async function editMessageText(
|
|
45
|
-
return telegram_api_1.TelegramAPI.post('editMessageText', body,
|
|
44
|
+
async function editMessageText(body, config) {
|
|
45
|
+
return telegram_api_1.TelegramAPI.post('editMessageText', body, config);
|
|
46
46
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { ExportChatInviteLink } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function exportChatInviteLink(body: ExportChatInviteLink, config?: TelegramApiConfig): Promise<string | FetchError>;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exportChatInviteLink = exportChatInviteLink;
|
|
4
4
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
5
|
-
async function exportChatInviteLink(
|
|
6
|
-
return telegram_api_1.TelegramAPI.post('exportChatInviteLink', body,
|
|
5
|
+
async function exportChatInviteLink(body, config) {
|
|
6
|
+
return telegram_api_1.TelegramAPI.post('exportChatInviteLink', body, config);
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { ForwardMessage, ForwardMessages, Message, MessageId } from '@aracna/telegram-bot-types';
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function forwardMessage(body: ForwardMessage, config?: TelegramApiConfig): Promise<Message | FetchError>;
|
|
5
|
+
export declare function forwardMessages(body: ForwardMessages, config?: TelegramApiConfig): Promise<MessageId[] | FetchError>;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.forwardMessage = forwardMessage;
|
|
4
4
|
exports.forwardMessages = forwardMessages;
|
|
5
5
|
const telegram_api_1 = require("../apis/telegram-api");
|
|
6
|
-
async function forwardMessage(
|
|
7
|
-
return telegram_api_1.TelegramAPI.post('forwardMessage', body,
|
|
6
|
+
async function forwardMessage(body, config) {
|
|
7
|
+
return telegram_api_1.TelegramAPI.post('forwardMessage', body, config);
|
|
8
8
|
}
|
|
9
|
-
async function forwardMessages(
|
|
10
|
-
return telegram_api_1.TelegramAPI.post('forwardMessages', body,
|
|
9
|
+
async function forwardMessages(body, config) {
|
|
10
|
+
return telegram_api_1.TelegramAPI.post('forwardMessages', body, config);
|
|
11
11
|
}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import type { FetchError } from '@aracna/core';
|
|
2
2
|
import type { BotCommand, BotDescription, BotName, BotShortDescription, BusinessConnection, Chat, ChatAdministratorRights, ChatMember, File, GameHighScore, GetBusinessConnection, GetChat, GetChatAdministrators, GetChatMember, GetChatMemberCount, GetChatMenuButton, GetCustomEmojiStickers, GetFile, GetGameHighScores, GetMyCommands, GetMyDefaultAdministratorRights, GetMyDescription, GetMyName, GetMyShortDescription, GetStarTransactions, GetStickerSet, GetUpdates, GetUserChatBoosts, GetUserProfilePhotos, MenuButton, StarTransactions, Sticker, StickerSet, Update, User, UserChatBoosts, UserProfilePhotos } 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
|
|
3
|
+
import type { TelegramApiConfig } from '../definitions/interfaces';
|
|
4
|
+
export declare function getBusinessConnection(body: GetBusinessConnection, config?: TelegramApiConfig): Promise<BusinessConnection | FetchError>;
|
|
5
|
+
export declare function getChat(body: GetChat, config?: TelegramApiConfig): Promise<Chat | FetchError>;
|
|
6
|
+
export declare function getChatAdministrators(body: GetChatAdministrators, config?: TelegramApiConfig): Promise<ChatMember[] | FetchError>;
|
|
7
|
+
export declare function getChatMember(body: GetChatMember, config?: TelegramApiConfig): Promise<ChatMember | FetchError>;
|
|
8
|
+
export declare function getChatMemberCount(body: GetChatMemberCount, config?: TelegramApiConfig): Promise<number | FetchError>;
|
|
9
|
+
export declare function getChatMenuButton(body: GetChatMenuButton, config?: TelegramApiConfig): Promise<MenuButton | FetchError>;
|
|
10
|
+
export declare function getCustomEmojiStickers(body: GetCustomEmojiStickers, config?: TelegramApiConfig): Promise<Sticker[] | FetchError>;
|
|
11
|
+
export declare function getFile(body: GetFile, config?: TelegramApiConfig): Promise<File | FetchError>;
|
|
12
|
+
export declare function getForumTopicIconStickers(config?: TelegramApiConfig): Promise<Sticker[] | FetchError>;
|
|
13
|
+
export declare function getGameHighScores(body: GetGameHighScores, config?: TelegramApiConfig): Promise<GameHighScore[] | FetchError>;
|
|
14
|
+
export declare function getMe(config?: TelegramApiConfig): Promise<User | FetchError>;
|
|
15
|
+
export declare function getMyCommands(body?: GetMyCommands, config?: TelegramApiConfig): Promise<BotCommand[] | FetchError>;
|
|
16
|
+
export declare function getMyDefaultAdministratorRights(body?: GetMyDefaultAdministratorRights, config?: TelegramApiConfig): Promise<ChatAdministratorRights | FetchError>;
|
|
17
|
+
export declare function getMyDescription(body?: GetMyDescription, config?: TelegramApiConfig): Promise<BotDescription | FetchError>;
|
|
18
|
+
export declare function getMyName(body?: GetMyName, config?: TelegramApiConfig): Promise<BotName | FetchError>;
|
|
19
|
+
export declare function getMyShortDescription(body?: GetMyShortDescription, config?: TelegramApiConfig): Promise<BotShortDescription | FetchError>;
|
|
20
|
+
export declare function getStarTransactions(body?: GetStarTransactions, config?: TelegramApiConfig): Promise<StarTransactions | FetchError>;
|
|
21
|
+
export declare function getStickerSet(body: GetStickerSet, config?: TelegramApiConfig): Promise<StickerSet | FetchError>;
|
|
22
|
+
export declare function getUpdates(body?: GetUpdates, config?: TelegramApiConfig): Promise<Update[] | FetchError>;
|
|
23
|
+
export declare function getUserChatBoosts(body: GetUserChatBoosts, config?: TelegramApiConfig): Promise<UserChatBoosts | FetchError>;
|
|
24
|
+
export declare function getUserProfilePhotos(body: GetUserProfilePhotos, config?: TelegramApiConfig): Promise<UserProfilePhotos | FetchError>;
|