@divyacon/piece-telegram-bot 0.0.0-stage → 0.1.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/LICENSE.MIT-AP +24 -0
- package/README.md +8 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +122 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/action/answer-callback-query.action.d.ts +8 -0
- package/dist/lib/action/answer-callback-query.action.d.ts.map +1 -0
- package/dist/lib/action/answer-callback-query.action.js +63 -0
- package/dist/lib/action/answer-callback-query.action.js.map +1 -0
- package/dist/lib/action/create-invite-link.d.ts +9 -0
- package/dist/lib/action/create-invite-link.d.ts.map +1 -0
- package/dist/lib/action/create-invite-link.js +66 -0
- package/dist/lib/action/create-invite-link.js.map +1 -0
- package/dist/lib/action/delete-message.action.d.ts +6 -0
- package/dist/lib/action/delete-message.action.d.ts.map +1 -0
- package/dist/lib/action/delete-message.action.js +42 -0
- package/dist/lib/action/delete-message.action.js.map +1 -0
- package/dist/lib/action/edit-message-text.action.d.ts +12 -0
- package/dist/lib/action/edit-message-text.action.d.ts.map +1 -0
- package/dist/lib/action/edit-message-text.action.js +76 -0
- package/dist/lib/action/edit-message-text.action.js.map +1 -0
- package/dist/lib/action/forward-message.action.d.ts +10 -0
- package/dist/lib/action/forward-message.action.d.ts.map +1 -0
- package/dist/lib/action/forward-message.action.js +59 -0
- package/dist/lib/action/forward-message.action.js.map +1 -0
- package/dist/lib/action/get-chat-member.d.ts +6 -0
- package/dist/lib/action/get-chat-member.d.ts.map +1 -0
- package/dist/lib/action/get-chat-member.js +49 -0
- package/dist/lib/action/get-chat-member.js.map +1 -0
- package/dist/lib/action/get-chat.action.d.ts +5 -0
- package/dist/lib/action/get-chat.action.d.ts.map +1 -0
- package/dist/lib/action/get-chat.action.js +42 -0
- package/dist/lib/action/get-chat.action.js.map +1 -0
- package/dist/lib/action/get-file.action.d.ts +5 -0
- package/dist/lib/action/get-file.action.d.ts.map +1 -0
- package/dist/lib/action/get-file.action.js +69 -0
- package/dist/lib/action/get-file.action.js.map +1 -0
- package/dist/lib/action/pin-message.action.d.ts +7 -0
- package/dist/lib/action/pin-message.action.d.ts.map +1 -0
- package/dist/lib/action/pin-message.action.js +50 -0
- package/dist/lib/action/pin-message.action.js.map +1 -0
- package/dist/lib/action/request-approval-message.d.ts +7 -0
- package/dist/lib/action/request-approval-message.d.ts.map +1 -0
- package/dist/lib/action/request-approval-message.js +84 -0
- package/dist/lib/action/request-approval-message.js.map +1 -0
- package/dist/lib/action/send-audio.action.d.ts +18 -0
- package/dist/lib/action/send-audio.action.d.ts.map +1 -0
- package/dist/lib/action/send-audio.action.js +128 -0
- package/dist/lib/action/send-audio.action.js.map +1 -0
- package/dist/lib/action/send-chat-action.action.d.ts +7 -0
- package/dist/lib/action/send-chat-action.action.d.ts.map +1 -0
- package/dist/lib/action/send-chat-action.action.js +61 -0
- package/dist/lib/action/send-chat-action.action.js.map +1 -0
- package/dist/lib/action/send-document.action.d.ts +15 -0
- package/dist/lib/action/send-document.action.d.ts.map +1 -0
- package/dist/lib/action/send-document.action.js +104 -0
- package/dist/lib/action/send-document.action.js.map +1 -0
- package/dist/lib/action/send-location.action.d.ts +16 -0
- package/dist/lib/action/send-location.action.d.ts.map +1 -0
- package/dist/lib/action/send-location.action.js +83 -0
- package/dist/lib/action/send-location.action.js.map +1 -0
- package/dist/lib/action/send-media-group.action.d.ts +11 -0
- package/dist/lib/action/send-media-group.action.d.ts.map +1 -0
- package/dist/lib/action/send-media-group.action.js +97 -0
- package/dist/lib/action/send-media-group.action.js.map +1 -0
- package/dist/lib/action/send-media.action.d.ts +14 -0
- package/dist/lib/action/send-media.action.d.ts.map +1 -0
- package/dist/lib/action/send-media.action.js +198 -0
- package/dist/lib/action/send-media.action.js.map +1 -0
- package/dist/lib/action/send-poll.action.d.ts +21 -0
- package/dist/lib/action/send-poll.action.d.ts.map +1 -0
- package/dist/lib/action/send-poll.action.js +145 -0
- package/dist/lib/action/send-poll.action.js.map +1 -0
- package/dist/lib/action/send-text-message.action.d.ts +14 -0
- package/dist/lib/action/send-text-message.action.d.ts.map +1 -0
- package/dist/lib/action/send-text-message.action.js +63 -0
- package/dist/lib/action/send-text-message.action.js.map +1 -0
- package/dist/lib/action/telegram-answer-callback-query.d.ts +8 -0
- package/dist/lib/action/telegram-answer-callback-query.d.ts.map +1 -0
- package/dist/lib/action/telegram-answer-callback-query.js +68 -0
- package/dist/lib/action/telegram-answer-callback-query.js.map +1 -0
- package/dist/lib/action/telegram-create-invite-link.d.ts +8 -0
- package/dist/lib/action/telegram-create-invite-link.d.ts.map +1 -0
- package/dist/lib/action/telegram-create-invite-link.js +68 -0
- package/dist/lib/action/telegram-create-invite-link.js.map +1 -0
- package/dist/lib/action/telegram-delete-message.d.ts +5 -0
- package/dist/lib/action/telegram-delete-message.d.ts.map +1 -0
- package/dist/lib/action/telegram-delete-message.js +44 -0
- package/dist/lib/action/telegram-delete-message.js.map +1 -0
- package/dist/lib/action/telegram-edit-message-text.d.ts +10 -0
- package/dist/lib/action/telegram-edit-message-text.d.ts.map +1 -0
- package/dist/lib/action/telegram-edit-message-text.js +93 -0
- package/dist/lib/action/telegram-edit-message-text.js.map +1 -0
- package/dist/lib/action/telegram-forward-message.d.ts +9 -0
- package/dist/lib/action/telegram-forward-message.d.ts.map +1 -0
- package/dist/lib/action/telegram-forward-message.js +61 -0
- package/dist/lib/action/telegram-forward-message.js.map +1 -0
- package/dist/lib/action/telegram-get-bot-info.d.ts +2 -0
- package/dist/lib/action/telegram-get-bot-info.d.ts.map +1 -0
- package/dist/lib/action/telegram-get-bot-info.js +39 -0
- package/dist/lib/action/telegram-get-bot-info.js.map +1 -0
- package/dist/lib/action/telegram-get-chat-administrators.d.ts +4 -0
- package/dist/lib/action/telegram-get-chat-administrators.d.ts.map +1 -0
- package/dist/lib/action/telegram-get-chat-administrators.js +44 -0
- package/dist/lib/action/telegram-get-chat-administrators.js.map +1 -0
- package/dist/lib/action/telegram-get-chat-member-count.d.ts +4 -0
- package/dist/lib/action/telegram-get-chat-member-count.d.ts.map +1 -0
- package/dist/lib/action/telegram-get-chat-member-count.js +44 -0
- package/dist/lib/action/telegram-get-chat-member-count.js.map +1 -0
- package/dist/lib/action/telegram-get-chat-member.d.ts +5 -0
- package/dist/lib/action/telegram-get-chat-member.d.ts.map +1 -0
- package/dist/lib/action/telegram-get-chat-member.js +51 -0
- package/dist/lib/action/telegram-get-chat-member.js.map +1 -0
- package/dist/lib/action/telegram-get-chat.d.ts +4 -0
- package/dist/lib/action/telegram-get-chat.d.ts.map +1 -0
- package/dist/lib/action/telegram-get-chat.js +44 -0
- package/dist/lib/action/telegram-get-chat.js.map +1 -0
- package/dist/lib/action/telegram-get-file.d.ts +5 -0
- package/dist/lib/action/telegram-get-file.d.ts.map +1 -0
- package/dist/lib/action/telegram-get-file.js +72 -0
- package/dist/lib/action/telegram-get-file.js.map +1 -0
- package/dist/lib/action/telegram-pin-message.d.ts +6 -0
- package/dist/lib/action/telegram-pin-message.d.ts.map +1 -0
- package/dist/lib/action/telegram-pin-message.js +52 -0
- package/dist/lib/action/telegram-pin-message.js.map +1 -0
- package/dist/lib/action/telegram-send-audio.d.ts +16 -0
- package/dist/lib/action/telegram-send-audio.d.ts.map +1 -0
- package/dist/lib/action/telegram-send-audio.js +149 -0
- package/dist/lib/action/telegram-send-audio.js.map +1 -0
- package/dist/lib/action/telegram-send-chat-action.d.ts +6 -0
- package/dist/lib/action/telegram-send-chat-action.d.ts.map +1 -0
- package/dist/lib/action/telegram-send-chat-action.js +67 -0
- package/dist/lib/action/telegram-send-chat-action.js.map +1 -0
- package/dist/lib/action/telegram-send-document.d.ts +13 -0
- package/dist/lib/action/telegram-send-document.d.ts.map +1 -0
- package/dist/lib/action/telegram-send-document.js +125 -0
- package/dist/lib/action/telegram-send-document.js.map +1 -0
- package/dist/lib/action/telegram-send-location.d.ts +15 -0
- package/dist/lib/action/telegram-send-location.d.ts.map +1 -0
- package/dist/lib/action/telegram-send-location.js +93 -0
- package/dist/lib/action/telegram-send-location.js.map +1 -0
- package/dist/lib/action/telegram-send-media-group.d.ts +10 -0
- package/dist/lib/action/telegram-send-media-group.d.ts.map +1 -0
- package/dist/lib/action/telegram-send-media-group.js +115 -0
- package/dist/lib/action/telegram-send-media-group.js.map +1 -0
- package/dist/lib/action/telegram-send-message.d.ts +12 -0
- package/dist/lib/action/telegram-send-message.d.ts.map +1 -0
- package/dist/lib/action/telegram-send-message.js +84 -0
- package/dist/lib/action/telegram-send-message.js.map +1 -0
- package/dist/lib/action/telegram-send-photo-or-video.d.ts +12 -0
- package/dist/lib/action/telegram-send-photo-or-video.d.ts.map +1 -0
- package/dist/lib/action/telegram-send-photo-or-video.js +219 -0
- package/dist/lib/action/telegram-send-photo-or-video.js.map +1 -0
- package/dist/lib/action/telegram-send-poll.d.ts +20 -0
- package/dist/lib/action/telegram-send-poll.d.ts.map +1 -0
- package/dist/lib/action/telegram-send-poll.js +167 -0
- package/dist/lib/action/telegram-send-poll.js.map +1 -0
- package/dist/lib/action/telegram-unpin-message.d.ts +5 -0
- package/dist/lib/action/telegram-unpin-message.d.ts.map +1 -0
- package/dist/lib/action/telegram-unpin-message.js +45 -0
- package/dist/lib/action/telegram-unpin-message.js.map +1 -0
- package/dist/lib/action/unpin-message.action.d.ts +6 -0
- package/dist/lib/action/unpin-message.action.d.ts.map +1 -0
- package/dist/lib/action/unpin-message.action.js +43 -0
- package/dist/lib/action/unpin-message.action.js.map +1 -0
- package/dist/lib/common/index.d.ts +25 -0
- package/dist/lib/common/index.d.ts.map +1 -0
- package/dist/lib/common/index.js +104 -0
- package/dist/lib/common/index.js.map +1 -0
- package/dist/lib/output-schemas.d.ts +41 -0
- package/dist/lib/output-schemas.d.ts.map +1 -0
- package/dist/lib/output-schemas.js +1853 -0
- package/dist/lib/output-schemas.js.map +1 -0
- package/dist/lib/trigger/new-message.d.ts +15 -0
- package/dist/lib/trigger/new-message.d.ts.map +1 -0
- package/dist/lib/trigger/new-message.js +121 -0
- package/dist/lib/trigger/new-message.js.map +1 -0
- package/package.json +44 -3
- package/src/index.ts +119 -0
- package/src/lib/action/answer-callback-query.action.ts +58 -0
- package/src/lib/action/create-invite-link.ts +59 -0
- package/src/lib/action/delete-message.action.ts +34 -0
- package/src/lib/action/edit-message-text.action.ts +71 -0
- package/src/lib/action/forward-message.action.ts +50 -0
- package/src/lib/action/get-chat-member.ts +40 -0
- package/src/lib/action/get-chat.action.ts +33 -0
- package/src/lib/action/get-file.action.ts +79 -0
- package/src/lib/action/pin-message.action.ts +41 -0
- package/src/lib/action/request-approval-message.ts +85 -0
- package/src/lib/action/send-audio.action.ts +123 -0
- package/src/lib/action/send-chat-action.action.ts +53 -0
- package/src/lib/action/send-document.action.ts +105 -0
- package/src/lib/action/send-location.action.ts +76 -0
- package/src/lib/action/send-media-group.action.ts +98 -0
- package/src/lib/action/send-media.action.ts +209 -0
- package/src/lib/action/send-poll.action.ts +140 -0
- package/src/lib/action/send-text-message.action.ts +54 -0
- package/src/lib/action/telegram-answer-callback-query.ts +64 -0
- package/src/lib/action/telegram-create-invite-link.ts +62 -0
- package/src/lib/action/telegram-delete-message.ts +37 -0
- package/src/lib/action/telegram-edit-message-text.ts +92 -0
- package/src/lib/action/telegram-forward-message.ts +54 -0
- package/src/lib/action/telegram-get-bot-info.ts +31 -0
- package/src/lib/action/telegram-get-chat-administrators.ts +36 -0
- package/src/lib/action/telegram-get-chat-member-count.ts +36 -0
- package/src/lib/action/telegram-get-chat-member.ts +43 -0
- package/src/lib/action/telegram-get-chat.ts +36 -0
- package/src/lib/action/telegram-get-file.ts +83 -0
- package/src/lib/action/telegram-pin-message.ts +45 -0
- package/src/lib/action/telegram-send-audio.ts +157 -0
- package/src/lib/action/telegram-send-chat-action.ts +61 -0
- package/src/lib/action/telegram-send-document.ts +136 -0
- package/src/lib/action/telegram-send-location.ts +89 -0
- package/src/lib/action/telegram-send-media-group.ts +119 -0
- package/src/lib/action/telegram-send-message.ts +79 -0
- package/src/lib/action/telegram-send-photo-or-video.ts +238 -0
- package/src/lib/action/telegram-send-poll.ts +170 -0
- package/src/lib/action/telegram-unpin-message.ts +38 -0
- package/src/lib/action/unpin-message.action.ts +36 -0
- package/src/lib/common/index.ts +147 -0
- package/src/lib/output-schemas.ts +1909 -0
- package/src/lib/trigger/new-message.ts +127 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.telegramGetChatMemberAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/telegram-bot/src/lib/action/get-chat-member.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const __1 = require("../..");
|
|
10
|
+
const common_1 = require("../common");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.telegramGetChatMemberAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: __1.telegramBotAuth,
|
|
14
|
+
name: 'get_chat_member',
|
|
15
|
+
description: 'Get member info (or null) for the provided chat id and user id',
|
|
16
|
+
audience: 'human',
|
|
17
|
+
aiMetadata: { description: 'Looks up a specific user\'s membership in a chat by chat_id and user_id, returning their role and status (member, administrator, left, kicked, etc.). Use to check whether a user belongs to a chat or what permissions they hold before acting. Idempotent: read-only lookup with no side effects.', idempotent: true },
|
|
18
|
+
displayName: 'Get Chat Member',
|
|
19
|
+
props: {
|
|
20
|
+
instructions: common_1.telegramCommons.chatIdInstructions(),
|
|
21
|
+
chat_id: common_1.telegramCommons.chatIdProp(),
|
|
22
|
+
user_id: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'User Id',
|
|
24
|
+
description: 'Unique identifier for the user',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
outputSchema: output_schemas_1.getChatMemberActionOutputSchema,
|
|
29
|
+
run(ctx) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
try {
|
|
32
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
33
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
34
|
+
url: common_1.telegramCommons.getApiUrl(ctx.auth, 'getChatMember'),
|
|
35
|
+
headers: {},
|
|
36
|
+
body: {
|
|
37
|
+
chat_id: ctx.propsValue.chat_id,
|
|
38
|
+
user_id: ctx.propsValue.user_id,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
return response.body;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return error.errorMessage().response.body;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=get-chat-member.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-chat-member.js","sourceRoot":"","sources":["../../../src/lib/action/get-chat-member.ts"],"names":[],"mappings":";;;;AAAA,6GAA6G;AAC7G,qEAAqE;AACrE,0DAA2E;AAC3E,gEAAmE;AACnE,6BAAwC;AACxC,sCAA4C;AAC5C,sDAAoE;AAEvD,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,gEAAgE;IAC7E,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,EAAE,WAAW,EAAE,qSAAqS,EAAE,UAAU,EAAE,IAAI,EAAE;IACpV,WAAW,EAAE,iBAAiB;IAC9B,KAAK,EAAE;QACL,YAAY,EAAE,wBAAe,CAAC,kBAAkB,EAAE;QAClD,OAAO,EAAE,wBAAe,CAAC,UAAU,EAAE;QACrC,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,YAAY,EAAE,gDAA+B;IACvC,GAAG,CAAC,GAAG;;YACX,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAQ;oBACnD,MAAM,EAAE,0BAAU,CAAC,IAAI;oBACvB,GAAG,EAAE,wBAAe,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,eAAe,CAAC;oBACzD,OAAO,EAAE,EAAE;oBACX,IAAI,EAAE;wBACJ,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO;wBAC/B,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO;qBAChC;iBACF,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAQ,KAAmB,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const telegramGetChatAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
instructions: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
chat_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
5
|
+
//# sourceMappingURL=get-chat.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-chat.action.d.ts","sourceRoot":"","sources":["../../../src/lib/action/get-chat.action.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,qBAAqB;;;EA0BhC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.telegramGetChatAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/telegram-bot/src/lib/action/get-chat.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const __1 = require("../..");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.telegramGetChatAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: __1.telegramBotAuth,
|
|
14
|
+
name: 'get_chat',
|
|
15
|
+
displayName: 'Get Chat',
|
|
16
|
+
description: 'Get up-to-date information about a chat (name, description, photo, member count, etc.)',
|
|
17
|
+
audience: 'human',
|
|
18
|
+
aiMetadata: { description: 'Looks up current details about a chat (title, description, type, photo, member count, etc.) by chat_id. Use to resolve or inspect a chat before acting on it; the bot must be a member of or have access to the chat. Idempotent: read-only lookup with no side effects.', idempotent: true },
|
|
19
|
+
props: {
|
|
20
|
+
instructions: common_1.telegramCommons.chatIdInstructions(),
|
|
21
|
+
chat_id: common_1.telegramCommons.chatIdProp(),
|
|
22
|
+
},
|
|
23
|
+
outputSchema: output_schemas_1.getChatActionOutputSchema,
|
|
24
|
+
run(ctx) {
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
try {
|
|
27
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
28
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
29
|
+
url: common_1.telegramCommons.getApiUrl(ctx.auth, 'getChat'),
|
|
30
|
+
body: {
|
|
31
|
+
chat_id: ctx.propsValue.chat_id,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
return response.body;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return error.errorMessage().response.body;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=get-chat.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-chat.action.js","sourceRoot":"","sources":["../../../src/lib/action/get-chat.action.ts"],"names":[],"mappings":";;;;AAAA,6GAA6G;AAC7G,qEAAqE;AACrE,0DAA2E;AAC3E,gEAAyD;AACzD,sCAA4C;AAC5C,6BAAwC;AACxC,sDAA8D;AAEjD,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,wFAAwF;IACrG,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,EAAE,WAAW,EAAE,0QAA0Q,EAAE,UAAU,EAAE,IAAI,EAAE;IACzT,KAAK,EAAE;QACL,YAAY,EAAE,wBAAe,CAAC,kBAAkB,EAAE;QAClD,OAAO,EAAE,wBAAe,CAAC,UAAU,EAAE;KACtC;IACD,YAAY,EAAE,0CAAyB;IACjC,GAAG,CAAC,GAAG;;YACX,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAQ;oBACnD,MAAM,EAAE,0BAAU,CAAC,IAAI;oBACvB,GAAG,EAAE,wBAAe,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC;oBACnD,IAAI,EAAE;wBACJ,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO;qBAChC;iBACF,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAQ,KAAmB,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3D,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const telegramGetFileAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
file_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
download: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
4
|
+
}>;
|
|
5
|
+
//# sourceMappingURL=get-file.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-file.action.d.ts","sourceRoot":"","sources":["../../../src/lib/action/get-file.action.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,qBAAqB;;;EA4DhC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.telegramGetFileAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/telegram-bot/src/lib/action/get-file.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const __1 = require("../..");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.telegramGetFileAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: __1.telegramBotAuth,
|
|
14
|
+
name: 'get_file',
|
|
15
|
+
description: 'Get file information and optionally download a file from Telegram',
|
|
16
|
+
audience: 'human',
|
|
17
|
+
aiMetadata: { description: 'Resolves a Telegram file_id to its file metadata and download URL, and optionally downloads the file content as base64 when download is enabled. Use to retrieve files attached to messages the bot received. Idempotent: read/download with no side effects, though Telegram download URLs are time-limited.', idempotent: true },
|
|
18
|
+
displayName: 'Get File',
|
|
19
|
+
props: {
|
|
20
|
+
file_id: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'File ID',
|
|
22
|
+
description: 'File identifier to get information about',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
download: pieces_framework_1.Property.Checkbox({
|
|
26
|
+
displayName: 'Download File',
|
|
27
|
+
description: 'If enabled, the file is downloaded and returned as base64.',
|
|
28
|
+
required: false,
|
|
29
|
+
defaultValue: false,
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
outputSchema: output_schemas_1.getFileActionOutputSchema,
|
|
33
|
+
run(ctx) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const fileInfoResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
36
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
37
|
+
url: common_1.telegramCommons.getApiUrl(ctx.auth, 'getFile'),
|
|
38
|
+
body: {
|
|
39
|
+
file_id: ctx.propsValue.file_id,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
if (!fileInfoResponse.body.ok) {
|
|
43
|
+
throw new Error(`Failed to get file info: ${JSON.stringify(fileInfoResponse.body)}`);
|
|
44
|
+
}
|
|
45
|
+
const fileInfo = fileInfoResponse.body.result;
|
|
46
|
+
const fileUrl = fileInfo.file_path
|
|
47
|
+
? `https://api.telegram.org/file/bot${ctx.auth.secret_text}/${fileInfo.file_path}`
|
|
48
|
+
: undefined;
|
|
49
|
+
if (ctx.propsValue.download && fileUrl) {
|
|
50
|
+
const fileResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
51
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
52
|
+
url: fileUrl,
|
|
53
|
+
responseType: 'arraybuffer',
|
|
54
|
+
});
|
|
55
|
+
const base64Content = Buffer.from(fileResponse.body).toString('base64');
|
|
56
|
+
return {
|
|
57
|
+
file_info: fileInfo,
|
|
58
|
+
file_url: fileUrl,
|
|
59
|
+
file_content_base64: base64Content,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
file_info: fileInfo,
|
|
64
|
+
file_url: fileUrl,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=get-file.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-file.action.js","sourceRoot":"","sources":["../../../src/lib/action/get-file.action.ts"],"names":[],"mappings":";;;;AAAA,6GAA6G;AAC7G,qEAAqE;AACrE,gEAAmE;AACnE,0DAAgE;AAChE,sCAA4C;AAC5C,6BAAwC;AACxC,sDAA8D;AAcjD,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,mEAAmE;IAChF,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,EAAE,WAAW,EAAE,+SAA+S,EAAE,UAAU,EAAE,IAAI,EAAE;IAC9V,WAAW,EAAE,UAAU;IACvB,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;KACH;IACD,YAAY,EAAE,0CAAyB;IACjC,GAAG,CAAC,GAAG;;YACX,MAAM,gBAAgB,GAAG,MAAM,0BAAU,CAAC,WAAW,CAA0B;gBAC7E,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,wBAAe,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC;gBACnD,IAAI,EAAE;oBACJ,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO;iBAChC;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACvF,CAAC;YAED,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9C,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS;gBAChC,CAAC,CAAC,oCAAoC,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,QAAQ,CAAC,SAAS,EAAE;gBAClF,CAAC,CAAC,SAAS,CAAC;YAEd,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,IAAI,OAAO,EAAE,CAAC;gBACvC,MAAM,YAAY,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAS;oBACxD,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,GAAG,EAAE,OAAO;oBACZ,YAAY,EAAE,aAAa;iBAC5B,CAAC,CAAC;gBAEH,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBAExE,OAAO;oBACL,SAAS,EAAE,QAAQ;oBACnB,QAAQ,EAAE,OAAO;oBACjB,mBAAmB,EAAE,aAAa;iBACnC,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,SAAS,EAAE,QAAQ;gBACnB,QAAQ,EAAE,OAAO;aAClB,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const telegramPinMessageAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
instructions: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
chat_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
message_id: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
5
|
+
disable_notification: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=pin-message.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pin-message.action.d.ts","sourceRoot":"","sources":["../../../src/lib/action/pin-message.action.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,wBAAwB;;;;;EAkCnC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.telegramPinMessageAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/telegram-bot/src/lib/action/pin-message.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const __1 = require("../..");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.telegramPinMessageAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: __1.telegramBotAuth,
|
|
14
|
+
name: 'pin_message',
|
|
15
|
+
displayName: 'Pin Message',
|
|
16
|
+
description: 'Pin a message in a chat. The bot must be an administrator in the chat for this to work.',
|
|
17
|
+
audience: 'human',
|
|
18
|
+
aiMetadata: { description: 'Pins an existing message in a chat, identified by chat_id and message_id; the bot must be an administrator with pin rights. Use to highlight an announcement or important message. Idempotent: pinning an already-pinned message leaves it pinned with the same result.', idempotent: true },
|
|
19
|
+
props: {
|
|
20
|
+
instructions: common_1.telegramCommons.chatIdInstructions(),
|
|
21
|
+
chat_id: common_1.telegramCommons.chatIdProp(),
|
|
22
|
+
message_id: pieces_framework_1.Property.Number({
|
|
23
|
+
displayName: 'Message Id',
|
|
24
|
+
description: 'Identifier of the message to pin.',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
disable_notification: pieces_framework_1.Property.Checkbox({
|
|
28
|
+
displayName: 'Disable Notification',
|
|
29
|
+
description: 'Pass True if it is not necessary to send a notification to all chat members.',
|
|
30
|
+
required: false,
|
|
31
|
+
defaultValue: false,
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
outputSchema: output_schemas_1.pinMessageActionOutputSchema,
|
|
35
|
+
run(ctx) {
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
var _a;
|
|
38
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
39
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
40
|
+
url: common_1.telegramCommons.getApiUrl(ctx.auth, 'pinChatMessage'),
|
|
41
|
+
body: {
|
|
42
|
+
chat_id: ctx.propsValue.chat_id,
|
|
43
|
+
message_id: ctx.propsValue.message_id,
|
|
44
|
+
disable_notification: (_a = ctx.propsValue.disable_notification) !== null && _a !== void 0 ? _a : false,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=pin-message.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pin-message.action.js","sourceRoot":"","sources":["../../../src/lib/action/pin-message.action.ts"],"names":[],"mappings":";;;;AAAA,gHAAgH;AAChH,qEAAqE;AACrE,gEAAmE;AACnE,0DAAgE;AAChE,sCAA4C;AAC5C,6BAAwC;AACxC,sDAAiE;AAEpD,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,yFAAyF;IACtG,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,EAAE,WAAW,EAAE,yQAAyQ,EAAE,UAAU,EAAE,IAAI,EAAE;IACxT,KAAK,EAAE;QACL,YAAY,EAAE,wBAAe,CAAC,kBAAkB,EAAE;QAClD,OAAO,EAAE,wBAAe,CAAC,UAAU,EAAE;QACrC,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,oBAAoB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtC,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,8EAA8E;YAC3F,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;KACH;IACD,YAAY,EAAE,6CAA4B;IACpC,GAAG,CAAC,GAAG;;;YACX,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAQ;gBACzC,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,wBAAe,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC;gBAC1D,IAAI,EAAE;oBACJ,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO;oBAC/B,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,UAAU;oBACrC,oBAAoB,EAAE,MAAA,GAAG,CAAC,UAAU,CAAC,oBAAoB,mCAAI,KAAK;iBACnE;aACF,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const telegramRequestApprovalMessageAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
instructions: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
chat_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
message: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
parse_mode: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=request-approval-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-approval-message.d.ts","sourceRoot":"","sources":["../../../src/lib/action/request-approval-message.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,oCAAoC;;;;;EA4E/C,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.telegramRequestApprovalMessageAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/telegram-bot/src/lib/action/request-approval-message.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const __1 = require("../..");
|
|
11
|
+
const pieces_framework_2 = require("@agnocon/pieces-framework");
|
|
12
|
+
const pieces_framework_3 = require("@agnocon/pieces-framework");
|
|
13
|
+
const output_schemas_1 = require("../output-schemas");
|
|
14
|
+
exports.telegramRequestApprovalMessageAction = (0, pieces_framework_1.createAction)({
|
|
15
|
+
auth: __1.telegramBotAuth,
|
|
16
|
+
name: 'request_approval_message',
|
|
17
|
+
displayName: 'Request Approval Message',
|
|
18
|
+
description: 'Send an approval message to a chat and wait until the message is approved or disapproved',
|
|
19
|
+
audience: 'both',
|
|
20
|
+
aiMetadata: { description: 'Sends a message with a single button linking to a confirmation page where the recipient chooses Approve or Disapprove, then pauses the flow until they respond and resumes with the decision. Use as a human approval gate before a sensitive downstream step. Not idempotent: each call sends a new message and opens a new pause/wait.', idempotent: false },
|
|
21
|
+
props: {
|
|
22
|
+
instructions: common_1.telegramCommons.chatIdInstructions(),
|
|
23
|
+
chat_id: common_1.telegramCommons.chatIdProp(),
|
|
24
|
+
message: pieces_framework_1.Property.LongText({
|
|
25
|
+
displayName: 'Message',
|
|
26
|
+
description: 'The approval message to be sent',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
parse_mode: common_1.telegramCommons.parseModeProp(),
|
|
30
|
+
},
|
|
31
|
+
outputSchema: output_schemas_1.requestApprovalMessageActionOutputSchema,
|
|
32
|
+
run(context) {
|
|
33
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (context.executionType === pieces_framework_3.ExecutionType.BEGIN) {
|
|
35
|
+
const token = context.auth.secret_text;
|
|
36
|
+
const { chat_id, message, parse_mode } = context.propsValue;
|
|
37
|
+
(0, pieces_framework_2.assertNotNullOrUndefined)(token, 'token');
|
|
38
|
+
(0, pieces_framework_2.assertNotNullOrUndefined)(message, 'message');
|
|
39
|
+
(0, pieces_framework_2.assertNotNullOrUndefined)(chat_id, 'chat_id');
|
|
40
|
+
// Generate approval and disapproval links
|
|
41
|
+
const waitpoint = yield context.run.createWaitpoint({
|
|
42
|
+
type: 'WEBHOOK',
|
|
43
|
+
});
|
|
44
|
+
const confirmationLink = `${waitpoint.resumeUrl}/confirm?chat_id=${encodeURIComponent(chat_id)}`;
|
|
45
|
+
// Send message with a single button opening the confirmation page (the recipient
|
|
46
|
+
// chooses Approve/Disapprove there). A single link keeps the message-preview
|
|
47
|
+
// prefetch from consuming the waitpoint.
|
|
48
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
49
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
50
|
+
url: common_1.telegramCommons.getApiUrl(context.auth, 'sendMessage'),
|
|
51
|
+
body: {
|
|
52
|
+
chat_id,
|
|
53
|
+
text: message,
|
|
54
|
+
parse_mode: common_1.telegramCommons.resolveParseMode(parse_mode),
|
|
55
|
+
reply_markup: {
|
|
56
|
+
inline_keyboard: [
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
text: 'Review & Respond',
|
|
60
|
+
url: confirmationLink,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
const messageId = response.body.result.message_id;
|
|
68
|
+
context.run.waitForWaitpoint(waitpoint.id);
|
|
69
|
+
return {
|
|
70
|
+
approved: false, // default approval is false
|
|
71
|
+
messageId,
|
|
72
|
+
chatId: chat_id,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return {
|
|
77
|
+
approved: context.resumePayload.queryParams['action'] === 'approve',
|
|
78
|
+
chatId: context.resumePayload.queryParams['chat_id'],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=request-approval-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-approval-message.js","sourceRoot":"","sources":["../../../src/lib/action/request-approval-message.ts"],"names":[],"mappings":";;;;AAAA,sHAAsH;AACtH,qEAAqE;AACrE,gEAAmE;AACnE,0DAAgE;AAChE,sCAA4C;AAC5C,6BAAwC;AACxC,gEAAqE;AACrE,gEAA0D;AAC1D,sDAA6E;AAEhE,QAAA,oCAAoC,GAAG,IAAA,+BAAY,EAAC;IAC/D,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EACT,0FAA0F;IAC5F,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,0UAA0U,EAAE,UAAU,EAAE,KAAK,EAAE;IAC1X,KAAK,EAAE;QACL,YAAY,EAAE,wBAAe,CAAC,kBAAkB,EAAE;QAClD,OAAO,EAA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EAAE;4BACZ,eAAe,EAAE;gCACf;oCACE;wCACE,IAAI,EAAE,kBAAkB;wCACxB,GAAG,EAAE,gBAAgB;qCACtB;iCACF;6BACF;yBACF;qBACF;iBACF,CAAC,CAAC;gBAEH,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;gBAElD,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;gBAE3C,OAAO;oBACL,QAAQ,EAAE,KAAK,EAAE,4BAA4B;oBAC7C,SAAS;oBACT,MAAM,EAAE,OAAO;iBAChB,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO;oBACL,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,SAAS;oBACnE,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC;iBACrD,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const telegramSendAudioAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
instructions: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
chat_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
message_thread_id: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
audio: import("@agnocon/pieces-framework").FileProperty<false, false>;
|
|
6
|
+
audio_id: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
caption: import("@agnocon/pieces-framework").LongTextProperty<false>;
|
|
8
|
+
format: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
instructions_format: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
10
|
+
duration: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
11
|
+
performer: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
title: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
disable_notification: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
14
|
+
protect_content: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
15
|
+
reply_to_message_id: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
16
|
+
reply_markup: import("@agnocon/pieces-framework").JsonProperty<false>;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=send-audio.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-audio.action.d.ts","sourceRoot":"","sources":["../../../src/lib/action/send-audio.action.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;EA2GlC,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.telegramSendAudioAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/telegram-bot/src/lib/action/send-audio.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
10
|
+
const common_1 = require("../common");
|
|
11
|
+
const __1 = require("../..");
|
|
12
|
+
const output_schemas_1 = require("../output-schemas");
|
|
13
|
+
exports.telegramSendAudioAction = (0, pieces_framework_1.createAction)({
|
|
14
|
+
auth: __1.telegramBotAuth,
|
|
15
|
+
name: 'send_audio',
|
|
16
|
+
displayName: 'Send Audio',
|
|
17
|
+
description: 'Send an audio file to a Telegram chat (.MP3/.M4A — shown in the music player)',
|
|
18
|
+
audience: 'human',
|
|
19
|
+
aiMetadata: { description: 'Sends an audio file (.MP3/.M4A) to a Telegram chat where it appears in the music player, supplied as a file or a previously uploaded file_id, with optional performer and track title. Use for music or audio tracks; for raw file attachments use Send Document. Not idempotent: each call sends a new message.', idempotent: false },
|
|
20
|
+
props: {
|
|
21
|
+
instructions: common_1.telegramCommons.chatIdInstructions(),
|
|
22
|
+
chat_id: common_1.telegramCommons.chatIdProp(),
|
|
23
|
+
message_thread_id: common_1.telegramCommons.messageThreadIdProp(),
|
|
24
|
+
audio: pieces_framework_1.Property.File({
|
|
25
|
+
displayName: 'Audio',
|
|
26
|
+
description: 'The audio file to send (.MP3 or .M4A).',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
audio_id: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'Audio Id',
|
|
31
|
+
description: 'Reuse an audio file previously uploaded to Telegram by passing its file_id.',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
caption: pieces_framework_1.Property.LongText({
|
|
35
|
+
displayName: 'Caption',
|
|
36
|
+
description: 'Optional caption (0–1024 chars).',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
format: common_1.telegramCommons.parseModeProp(),
|
|
40
|
+
instructions_format: common_1.telegramCommons.formatLinkInstructions(),
|
|
41
|
+
duration: pieces_framework_1.Property.Number({
|
|
42
|
+
displayName: 'Duration',
|
|
43
|
+
description: 'Duration of the audio in seconds.',
|
|
44
|
+
required: false,
|
|
45
|
+
}),
|
|
46
|
+
performer: pieces_framework_1.Property.ShortText({
|
|
47
|
+
displayName: 'Performer',
|
|
48
|
+
description: 'Performer / artist name.',
|
|
49
|
+
required: false,
|
|
50
|
+
}),
|
|
51
|
+
title: pieces_framework_1.Property.ShortText({
|
|
52
|
+
displayName: 'Track Title',
|
|
53
|
+
description: 'Track title.',
|
|
54
|
+
required: false,
|
|
55
|
+
}),
|
|
56
|
+
disable_notification: common_1.telegramCommons.disableNotificationProp(),
|
|
57
|
+
protect_content: common_1.telegramCommons.protectContentProp(),
|
|
58
|
+
reply_to_message_id: common_1.telegramCommons.replyToMessageIdProp(),
|
|
59
|
+
reply_markup: common_1.telegramCommons.replyMarkupProp(),
|
|
60
|
+
},
|
|
61
|
+
outputSchema: output_schemas_1.sendAudioActionOutputSchema,
|
|
62
|
+
run(ctx) {
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
65
|
+
const file = ctx.propsValue.audio;
|
|
66
|
+
const audioId = ctx.propsValue.audio_id;
|
|
67
|
+
const parseMode = common_1.telegramCommons.resolveParseMode(ctx.propsValue.format);
|
|
68
|
+
if (!file && !audioId) {
|
|
69
|
+
throw new Error('Either an audio file or an audio id must be provided.');
|
|
70
|
+
}
|
|
71
|
+
const headers = {};
|
|
72
|
+
let body;
|
|
73
|
+
if (file && file.data && file.filename) {
|
|
74
|
+
const form = new form_data_1.default();
|
|
75
|
+
form.append('audio', file.data, file.filename);
|
|
76
|
+
form.append('chat_id', ctx.propsValue.chat_id);
|
|
77
|
+
if (ctx.propsValue.caption)
|
|
78
|
+
form.append('caption', ctx.propsValue.caption);
|
|
79
|
+
if (ctx.propsValue.message_thread_id) {
|
|
80
|
+
form.append('message_thread_id', ctx.propsValue.message_thread_id);
|
|
81
|
+
}
|
|
82
|
+
if (parseMode)
|
|
83
|
+
form.append('parse_mode', parseMode);
|
|
84
|
+
if (ctx.propsValue.duration)
|
|
85
|
+
form.append('duration', String(ctx.propsValue.duration));
|
|
86
|
+
if (ctx.propsValue.performer)
|
|
87
|
+
form.append('performer', ctx.propsValue.performer);
|
|
88
|
+
if (ctx.propsValue.title)
|
|
89
|
+
form.append('title', ctx.propsValue.title);
|
|
90
|
+
if (ctx.propsValue.disable_notification)
|
|
91
|
+
form.append('disable_notification', 'true');
|
|
92
|
+
if (ctx.propsValue.protect_content)
|
|
93
|
+
form.append('protect_content', 'true');
|
|
94
|
+
if (ctx.propsValue.reply_to_message_id) {
|
|
95
|
+
form.append('reply_to_message_id', String(ctx.propsValue.reply_to_message_id));
|
|
96
|
+
}
|
|
97
|
+
if (ctx.propsValue.reply_markup) {
|
|
98
|
+
form.append('reply_markup', JSON.stringify(ctx.propsValue.reply_markup));
|
|
99
|
+
}
|
|
100
|
+
body = form;
|
|
101
|
+
Object.assign(headers, form.getHeaders());
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
body = {
|
|
105
|
+
chat_id: ctx.propsValue.chat_id,
|
|
106
|
+
audio: audioId,
|
|
107
|
+
caption: (_a = ctx.propsValue.caption) !== null && _a !== void 0 ? _a : undefined,
|
|
108
|
+
message_thread_id: (_b = ctx.propsValue.message_thread_id) !== null && _b !== void 0 ? _b : undefined,
|
|
109
|
+
parse_mode: parseMode,
|
|
110
|
+
duration: (_c = ctx.propsValue.duration) !== null && _c !== void 0 ? _c : undefined,
|
|
111
|
+
performer: (_d = ctx.propsValue.performer) !== null && _d !== void 0 ? _d : undefined,
|
|
112
|
+
title: (_e = ctx.propsValue.title) !== null && _e !== void 0 ? _e : undefined,
|
|
113
|
+
disable_notification: (_f = ctx.propsValue.disable_notification) !== null && _f !== void 0 ? _f : false,
|
|
114
|
+
protect_content: (_g = ctx.propsValue.protect_content) !== null && _g !== void 0 ? _g : false,
|
|
115
|
+
reply_to_message_id: (_h = ctx.propsValue.reply_to_message_id) !== null && _h !== void 0 ? _h : undefined,
|
|
116
|
+
reply_markup: (_j = ctx.propsValue.reply_markup) !== null && _j !== void 0 ? _j : undefined,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
120
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
121
|
+
url: common_1.telegramCommons.getApiUrl(ctx.auth, 'sendAudio'),
|
|
122
|
+
headers,
|
|
123
|
+
body,
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=send-audio.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-audio.action.js","sourceRoot":"","sources":["../../../src/lib/action/send-audio.action.ts"],"names":[],"mappings":";;;;AAAA,+GAA+G;AAC/G,qEAAqE;AACrE,gEAImC;AACnC,0DAIgC;AAChC,kEAAiC;AACjC,sCAA4C;AAC5C,6BAAwC;AACxC,sDAAgE;AAEnD,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,+EAA+E;IAC5F,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,EAAE,WAAW,EAAE,kTAAkT,EAAE,UAAU,EAAE,KAAK,EAAE;IAClW,KAAK,EAAE;QACL,YAAY,EAAE,wBAAe,CAAC,kBAAkB,EAAE;QAClD,OAAO,EAAE,wBAAe,CAAC,UAAU,EAAE;QACrC,iBAAiB,EAAE,wBAAe,CAAC,mBAAmB,EAAE;QACxD,KAAK,EAAE,2BAAQ,CAAC,IAAI,CAAC;YACnB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,6EAA6E;YAC1F,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,wBAAe,CAAC,aAAa,EAAE;QACvC,mBAAmB,EAAE,wBAAe,CAAC,sBAAsB,EAAE;QAC7D,QAAQ,EAAE,2BAAQ,CAAC,MAAM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BAAe,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC;gBACrD,OAAO;gBACP,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const telegramSendChatActionAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
instructions: import("@agnocon/pieces-framework/dist/lib/property/input/markdown-property").MarkDownProperty;
|
|
3
|
+
chat_id: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
message_thread_id: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
action: import("@agnocon/pieces-framework").StaticDropdownProperty<string, true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=send-chat-action.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-chat-action.action.d.ts","sourceRoot":"","sources":["../../../src/lib/action/send-chat-action.action.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,4BAA4B;;;;;EA8CvC,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.telegramSendChatActionAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/telegram-bot/src/lib/action/send-chat-action.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const __1 = require("../..");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.telegramSendChatActionAction = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: __1.telegramBotAuth,
|
|
14
|
+
name: 'send_chat_action',
|
|
15
|
+
displayName: 'Send Chat Action',
|
|
16
|
+
description: 'Show a status (typing, uploading photo, recording voice, etc.) on behalf of the bot in a chat. The status is shown for up to 5 seconds.',
|
|
17
|
+
audience: 'human',
|
|
18
|
+
aiMetadata: { description: 'Broadcasts a transient activity status (such as typing or uploading photo) in a chat, shown for up to 5 seconds. Use just before a slower action to signal the bot is working; it sends no message and produces no persistent content. Not idempotent: each call re-broadcasts the status.', idempotent: false },
|
|
19
|
+
props: {
|
|
20
|
+
instructions: common_1.telegramCommons.chatIdInstructions(),
|
|
21
|
+
chat_id: common_1.telegramCommons.chatIdProp(),
|
|
22
|
+
message_thread_id: common_1.telegramCommons.messageThreadIdProp(),
|
|
23
|
+
action: pieces_framework_1.Property.StaticDropdown({
|
|
24
|
+
displayName: 'Action',
|
|
25
|
+
description: 'Type of action to broadcast.',
|
|
26
|
+
required: true,
|
|
27
|
+
options: {
|
|
28
|
+
options: [
|
|
29
|
+
{ label: 'Typing', value: 'typing' },
|
|
30
|
+
{ label: 'Upload Photo', value: 'upload_photo' },
|
|
31
|
+
{ label: 'Record Video', value: 'record_video' },
|
|
32
|
+
{ label: 'Upload Video', value: 'upload_video' },
|
|
33
|
+
{ label: 'Record Voice', value: 'record_voice' },
|
|
34
|
+
{ label: 'Upload Voice', value: 'upload_voice' },
|
|
35
|
+
{ label: 'Upload Document', value: 'upload_document' },
|
|
36
|
+
{ label: 'Choose Sticker', value: 'choose_sticker' },
|
|
37
|
+
{ label: 'Find Location', value: 'find_location' },
|
|
38
|
+
{ label: 'Record Video Note', value: 'record_video_note' },
|
|
39
|
+
{ label: 'Upload Video Note', value: 'upload_video_note' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
defaultValue: 'typing',
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
outputSchema: output_schemas_1.sendChatActionActionOutputSchema,
|
|
46
|
+
run(ctx) {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
var _a;
|
|
49
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
50
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
51
|
+
url: common_1.telegramCommons.getApiUrl(ctx.auth, 'sendChatAction'),
|
|
52
|
+
body: {
|
|
53
|
+
chat_id: ctx.propsValue.chat_id,
|
|
54
|
+
action: ctx.propsValue.action,
|
|
55
|
+
message_thread_id: (_a = ctx.propsValue.message_thread_id) !== null && _a !== void 0 ? _a : undefined,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=send-chat-action.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-chat-action.action.js","sourceRoot":"","sources":["../../../src/lib/action/send-chat-action.action.ts"],"names":[],"mappings":";;;;AAAA,qHAAqH;AACrH,qEAAqE;AACrE,gEAAmE;AACnE,0DAAgE;AAChE,sCAA4C;AAC5C,6BAAwC;AACxC,sDAAqE;AAExD,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI,EAAE,mBAAe;IACrB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACT,yIAAyI;IAC3I,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,EAAE,WAAW,EAAE,4RAA4R,EAAE,UAAU,EAAE,KAAK,EAAE;IAC5U,KAAK,EAAE;QACL,YAAY,EAAE,wBAAe,CAAC,kBAAkB,EAAE;QAClD,OAAO,EAAE,wBAAe,CAAC,UAAU,EAAE;QACrC,iBAAiB,EAAE,wBAAe,CAAC,mBAAmB,EAAE;QACxD,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EA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