@pipedream/telegram_bot_api 0.3.3
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 +7 -0
- package/actions/create-chat-invite-link/create-chat-invite-link.mjs +52 -0
- package/actions/delete-message/delete-message.mjs +29 -0
- package/actions/edit-media-message/edit-media-message.mjs +89 -0
- package/actions/edit-text-message/edit-text-message.mjs +45 -0
- package/actions/export-chat-invite-link/export-chat-invite-link.mjs +23 -0
- package/actions/forward-message/forward-message.mjs +48 -0
- package/actions/get-num-members-in-chat/get-num-members-in-chat.mjs +23 -0
- package/actions/kick-chat-member/kick-chat-member.mjs +38 -0
- package/actions/list-administrators-in-chat/list-administrators-in-chat.mjs +25 -0
- package/actions/list-chats/list-chats.mjs +73 -0
- package/actions/list-updates/list-updates.mjs +49 -0
- package/actions/pin-message/pin-message.mjs +37 -0
- package/actions/promote-chat-member/promote-chat-member.mjs +86 -0
- package/actions/restrict-chat-member/restrict-chat-member.mjs +66 -0
- package/actions/send-album/send-album.mjs +53 -0
- package/actions/send-audio-file/send-audio-file.mjs +98 -0
- package/actions/send-document-or-image/send-document-or-image.mjs +83 -0
- package/actions/send-media-by-url-or-id/send-media-by-url-or-id.mjs +73 -0
- package/actions/send-photo/send-photo.mjs +84 -0
- package/actions/send-sticker/send-sticker.mjs +53 -0
- package/actions/send-text-message-or-reply/send-text-message-or-reply.mjs +66 -0
- package/actions/send-video/send-video.mjs +86 -0
- package/actions/send-video-note/send-video-note.mjs +76 -0
- package/actions/send-voice-message/send-voice-message.mjs +85 -0
- package/actions/unpin-message/unpin-message.mjs +29 -0
- package/constants.mjs +198 -0
- package/content-types.mjs +115 -0
- package/env.mjs +14 -0
- package/package.json +21 -0
- package/sources/channel-updates/channel-updates.mjs +50 -0
- package/sources/message-updates/message-updates.mjs +50 -0
- package/sources/new-updates/new-updates.mjs +63 -0
- package/telegram_bot_api.app.mjs +682 -0
- package/update-types.mjs +50 -0
- package/utils.mjs +27 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import telegramBotApi from "../../telegram_bot_api.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "telegram_bot_api-restrict-chat-member",
|
|
5
|
+
name: "Restrict a Chat Member",
|
|
6
|
+
description: "Use this method to restrict a user in a supergroup. [See the docs](https://core.telegram.org/bots/api#restrictchatmember) for more information",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
telegramBotApi,
|
|
11
|
+
chatId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
telegramBotApi,
|
|
14
|
+
"chatId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
userId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
telegramBotApi,
|
|
20
|
+
"userId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
until_date: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
telegramBotApi,
|
|
26
|
+
"until_date",
|
|
27
|
+
],
|
|
28
|
+
description: "Enter the date when the restrictions will be lifted for the user, in [unix time](https://en.wikipedia.org/wiki/Unix_time) (e.g. `1567780450`).",
|
|
29
|
+
},
|
|
30
|
+
can_send_messages: {
|
|
31
|
+
type: "boolean",
|
|
32
|
+
label: "Set if the User Can Send Messages",
|
|
33
|
+
description: "Pass True, if the user can send text messages, contacts, locations and venues.",
|
|
34
|
+
optional: true,
|
|
35
|
+
},
|
|
36
|
+
can_send_media_messages: {
|
|
37
|
+
type: "boolean",
|
|
38
|
+
label: "Set if the User Can Send Media Messages",
|
|
39
|
+
description: "Pass True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages.",
|
|
40
|
+
optional: true,
|
|
41
|
+
},
|
|
42
|
+
can_send_other_messages: {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
label: "Set if the User Can send Other Messages",
|
|
45
|
+
description: "Pass True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages.",
|
|
46
|
+
optional: true,
|
|
47
|
+
},
|
|
48
|
+
can_add_web_page_previews: {
|
|
49
|
+
type: "boolean",
|
|
50
|
+
label: "Set if the User Can Add Web Page Previews",
|
|
51
|
+
description: "Pass True, if the user may add web page previews to their messages, implies can_send_media_messages.",
|
|
52
|
+
optional: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
async run({ $ }) {
|
|
56
|
+
const resp = await this.telegramBotApi.restrictChatMember(this.chatId, this.userId, {
|
|
57
|
+
until_date: this.until_date,
|
|
58
|
+
can_send_messages: this.can_send_messages,
|
|
59
|
+
can_send_media_messages: this.can_send_media_messages,
|
|
60
|
+
can_send_other_messages: this.can_send_other_messages,
|
|
61
|
+
can_add_web_page_previews: this.can_add_web_page_previews,
|
|
62
|
+
});
|
|
63
|
+
$.export("$summary", `Successfully restricted the user, "${this.userId}", in supergroup, "${this.chatId}"`);
|
|
64
|
+
return resp;
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import telegramBotApi from "../../telegram_bot_api.app.mjs";
|
|
2
|
+
import { toSingleLineString } from "../../utils.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "telegram_bot_api-send-album",
|
|
6
|
+
name: "Send an Album (Media Group)",
|
|
7
|
+
description: "Sends a group of photos or videos as an album. [See the docs](https://core.telegram.org/bots/api#sendmediagroup) for more information",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
telegramBotApi,
|
|
12
|
+
chatId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
telegramBotApi,
|
|
15
|
+
"chatId",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
media: {
|
|
19
|
+
type: "any",
|
|
20
|
+
label: "Media",
|
|
21
|
+
description: toSingleLineString(`
|
|
22
|
+
A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
|
|
23
|
+
(e.g.,
|
|
24
|
+
\`[{"type":"photo","media":"https://example.com/myImage.jpeg"},{"type":"video","media":"/tmp/myVideo.mp4"}]\`).
|
|
25
|
+
[See the docs](https://core.telegram.org/bots/api#inputmedia) for more information about the
|
|
26
|
+
input media object.
|
|
27
|
+
`),
|
|
28
|
+
optional: false,
|
|
29
|
+
},
|
|
30
|
+
disable_notification: {
|
|
31
|
+
propDefinition: [
|
|
32
|
+
telegramBotApi,
|
|
33
|
+
"disable_notification",
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
async run({ $ }) {
|
|
38
|
+
let media = this.media;
|
|
39
|
+
if (typeof media === "string") {
|
|
40
|
+
try {
|
|
41
|
+
media = JSON.parse(media);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
throw new Error("media must be deserializable to JSON");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const resp = await this.telegramBotApi.sendMediaGroup(this.chatId, media, {
|
|
47
|
+
disable_notification: this.disable_notification,
|
|
48
|
+
});
|
|
49
|
+
// eslint-disable-next-line multiline-ternary
|
|
50
|
+
$.export("$summary", `Successfully sent an album of ${resp.length} media file${resp.length === 1 ? "" : "s"} to chat, "${this.chatId}"`);
|
|
51
|
+
return resp;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import telegramBotApi from "../../telegram_bot_api.app.mjs";
|
|
2
|
+
import contentTypes from "../../content-types.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "telegram_bot_api-send-audio-file",
|
|
6
|
+
name: "Send an Audio File",
|
|
7
|
+
description: "Sends an audio file to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendaudio) for more information",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
telegramBotApi,
|
|
12
|
+
chatId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
telegramBotApi,
|
|
15
|
+
"chatId",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
caption: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
telegramBotApi,
|
|
21
|
+
"caption",
|
|
22
|
+
],
|
|
23
|
+
description: "Enter the audio caption.",
|
|
24
|
+
},
|
|
25
|
+
filename: {
|
|
26
|
+
propDefinition: [
|
|
27
|
+
telegramBotApi,
|
|
28
|
+
"filename",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
audio: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
telegramBotApi,
|
|
34
|
+
"media",
|
|
35
|
+
],
|
|
36
|
+
label: "Audio",
|
|
37
|
+
},
|
|
38
|
+
parse_mode: {
|
|
39
|
+
propDefinition: [
|
|
40
|
+
telegramBotApi,
|
|
41
|
+
"parse_mode",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
disable_notification: {
|
|
45
|
+
propDefinition: [
|
|
46
|
+
telegramBotApi,
|
|
47
|
+
"disable_notification",
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
duration: {
|
|
51
|
+
propDefinition: [
|
|
52
|
+
telegramBotApi,
|
|
53
|
+
"duration",
|
|
54
|
+
],
|
|
55
|
+
description: "Enter duration of sent audio in seconds.",
|
|
56
|
+
},
|
|
57
|
+
performer: {
|
|
58
|
+
propDefinition: [
|
|
59
|
+
telegramBotApi,
|
|
60
|
+
"performer",
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
title: {
|
|
64
|
+
propDefinition: [
|
|
65
|
+
telegramBotApi,
|
|
66
|
+
"title",
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
reply_markup: {
|
|
70
|
+
propDefinition: [
|
|
71
|
+
telegramBotApi,
|
|
72
|
+
"reply_markup",
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
contentType: {
|
|
76
|
+
propDefinition: [
|
|
77
|
+
telegramBotApi,
|
|
78
|
+
"contentType",
|
|
79
|
+
],
|
|
80
|
+
options: contentTypes.audio,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
async run({ $ }) {
|
|
84
|
+
const resp = await this.telegramBotApi.sendAudio(this.chatId, this.audio, {
|
|
85
|
+
caption: this.caption,
|
|
86
|
+
parse_mode: this.parse_mode,
|
|
87
|
+
disable_notification: this.disable_notification,
|
|
88
|
+
duration: this.duration,
|
|
89
|
+
performer: this.performer,
|
|
90
|
+
title: this.title,
|
|
91
|
+
reply_markup: this.reply_markup,
|
|
92
|
+
filename: this.filename,
|
|
93
|
+
contentType: this.contentType,
|
|
94
|
+
});
|
|
95
|
+
$.export("$summary", `Successfully sent the audio file "${resp.audio?.file_name}" to chat, "${this.chatId}""`);
|
|
96
|
+
return resp;
|
|
97
|
+
},
|
|
98
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import telegramBotApi from "../../telegram_bot_api.app.mjs";
|
|
2
|
+
import contentTypes from "../../content-types.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "telegram_bot_api-send-document-or-image",
|
|
6
|
+
name: "Send a Document/Image",
|
|
7
|
+
description: "Sends a document or an image to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#senddocument) for more information",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
telegramBotApi,
|
|
12
|
+
chatId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
telegramBotApi,
|
|
15
|
+
"chatId",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
caption: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
telegramBotApi,
|
|
21
|
+
"caption",
|
|
22
|
+
],
|
|
23
|
+
description: "Enter the file caption.",
|
|
24
|
+
},
|
|
25
|
+
filename: {
|
|
26
|
+
propDefinition: [
|
|
27
|
+
telegramBotApi,
|
|
28
|
+
"filename",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
doc: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
telegramBotApi,
|
|
34
|
+
"media",
|
|
35
|
+
],
|
|
36
|
+
label: "Document or Image",
|
|
37
|
+
},
|
|
38
|
+
parse_mode: {
|
|
39
|
+
propDefinition: [
|
|
40
|
+
telegramBotApi,
|
|
41
|
+
"parse_mode",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
contentType: {
|
|
45
|
+
propDefinition: [
|
|
46
|
+
telegramBotApi,
|
|
47
|
+
"contentType",
|
|
48
|
+
],
|
|
49
|
+
options: contentTypes.all,
|
|
50
|
+
},
|
|
51
|
+
disable_notification: {
|
|
52
|
+
propDefinition: [
|
|
53
|
+
telegramBotApi,
|
|
54
|
+
"disable_notification",
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
reply_to_message_id: {
|
|
58
|
+
propDefinition: [
|
|
59
|
+
telegramBotApi,
|
|
60
|
+
"reply_to_message_id",
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
reply_markup: {
|
|
64
|
+
propDefinition: [
|
|
65
|
+
telegramBotApi,
|
|
66
|
+
"reply_markup",
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
async run({ $ }) {
|
|
71
|
+
const resp = await this.telegramBotApi.sendDocument(this.chatId, this.doc, {
|
|
72
|
+
caption: this.caption,
|
|
73
|
+
parse_mode: this.parse_mode,
|
|
74
|
+
disable_notification: this.disable_notification,
|
|
75
|
+
reply_to_message_id: this.reply_to_message_id,
|
|
76
|
+
reply_markup: this.reply_markup,
|
|
77
|
+
filename: this.filename,
|
|
78
|
+
contentType: this.contentType,
|
|
79
|
+
});
|
|
80
|
+
$.export("$summary", `Successfully sent the document "${resp.document?.file_name}" to chat, "${this.chatId}"`);
|
|
81
|
+
return resp;
|
|
82
|
+
},
|
|
83
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import telegramBotApi from "../../telegram_bot_api.app.mjs";
|
|
2
|
+
import { TELEGRAM_BOT_API_UI_MEDIA_TYPES } from "../../constants.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "telegram_bot_api-send-media-by-url-or-id",
|
|
6
|
+
name: "Send Media by URL or ID",
|
|
7
|
+
description: "Sends a file (document, photo, video, audio, ...) by HTTP URL or by ID that exists on the Telegram servers. [See the docs](https://core.telegram.org/bots/api#inputmedia) for more information",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
telegramBotApi,
|
|
12
|
+
chatId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
telegramBotApi,
|
|
15
|
+
"chatId",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
caption: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
telegramBotApi,
|
|
21
|
+
"caption",
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
mediaType: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
telegramBotApi,
|
|
27
|
+
"type",
|
|
28
|
+
],
|
|
29
|
+
options: TELEGRAM_BOT_API_UI_MEDIA_TYPES,
|
|
30
|
+
},
|
|
31
|
+
media: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
telegramBotApi,
|
|
34
|
+
"media",
|
|
35
|
+
],
|
|
36
|
+
label: "Media",
|
|
37
|
+
description: "Pass a file_id to send a file that exists on the Telegram servers or pass an HTTP URL for Telegram to get a file from the Internet. File must meet Telegram's [requirements](https://core.telegram.org/bots/api#sending-files) for MIME type and size.",
|
|
38
|
+
},
|
|
39
|
+
disable_notification: {
|
|
40
|
+
propDefinition: [
|
|
41
|
+
telegramBotApi,
|
|
42
|
+
"disable_notification",
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
reply_to_message_id: {
|
|
46
|
+
propDefinition: [
|
|
47
|
+
telegramBotApi,
|
|
48
|
+
"reply_to_message_id",
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
reply_markup: {
|
|
52
|
+
propDefinition: [
|
|
53
|
+
telegramBotApi,
|
|
54
|
+
"reply_markup",
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
async run({ $ }) {
|
|
59
|
+
const resp = await this.telegramBotApi.sendMediaByType(
|
|
60
|
+
this.mediaType,
|
|
61
|
+
this.chatId,
|
|
62
|
+
this.media,
|
|
63
|
+
{
|
|
64
|
+
caption: this.caption,
|
|
65
|
+
disable_notification: this.disable_notification,
|
|
66
|
+
reply_to_message_id: this.reply_to_message_id,
|
|
67
|
+
reply_markup: this.reply_markup,
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
$.export("$summary", `Successfully sent the media file to chat, "${this.chatId}"`);
|
|
71
|
+
return resp;
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import telegramBotApi from "../../telegram_bot_api.app.mjs";
|
|
2
|
+
import contentTypes from "../../content-types.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "telegram_bot_api-send-photo",
|
|
6
|
+
name: "Send a Photo",
|
|
7
|
+
description: "Sends a photo to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendphoto) for more information",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
telegramBotApi,
|
|
12
|
+
chatId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
telegramBotApi,
|
|
15
|
+
"chatId",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
caption: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
telegramBotApi,
|
|
21
|
+
"caption",
|
|
22
|
+
],
|
|
23
|
+
description: "Enter the photo caption.",
|
|
24
|
+
},
|
|
25
|
+
filename: {
|
|
26
|
+
propDefinition: [
|
|
27
|
+
telegramBotApi,
|
|
28
|
+
"filename",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
photo: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
telegramBotApi,
|
|
34
|
+
"media",
|
|
35
|
+
],
|
|
36
|
+
label: "Photo",
|
|
37
|
+
},
|
|
38
|
+
disable_notification: {
|
|
39
|
+
propDefinition: [
|
|
40
|
+
telegramBotApi,
|
|
41
|
+
"disable_notification",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
parse_mode: {
|
|
45
|
+
propDefinition: [
|
|
46
|
+
telegramBotApi,
|
|
47
|
+
"parse_mode",
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
reply_to_message_id: {
|
|
51
|
+
propDefinition: [
|
|
52
|
+
telegramBotApi,
|
|
53
|
+
"reply_to_message_id",
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
reply_markup: {
|
|
57
|
+
propDefinition: [
|
|
58
|
+
telegramBotApi,
|
|
59
|
+
"reply_markup",
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
contentType: {
|
|
63
|
+
propDefinition: [
|
|
64
|
+
telegramBotApi,
|
|
65
|
+
"contentType",
|
|
66
|
+
],
|
|
67
|
+
options: contentTypes.image,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
async run({ $ }) {
|
|
71
|
+
const resp = await this.telegramBotApi.sendPhoto(this.chatId, this.photo, {
|
|
72
|
+
caption: this.caption,
|
|
73
|
+
disable_notification: this.disable_notification,
|
|
74
|
+
parse_mode: this.parse_mode,
|
|
75
|
+
reply_to_message_id: this.reply_to_message_id,
|
|
76
|
+
reply_markup: this.reply_markup,
|
|
77
|
+
filename: this.filename,
|
|
78
|
+
contentType: this.contentType,
|
|
79
|
+
});
|
|
80
|
+
// eslint-disable-next-line multiline-ternary
|
|
81
|
+
$.export("$summary", `Successfully sent the photo${this.fileName ? ` "${this.filename}"` : ""} to chat, "${this.chatId}"`);
|
|
82
|
+
return resp;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import telegramBotApi from "../../telegram_bot_api.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "telegram_bot_api-send-sticker",
|
|
5
|
+
name: "Send a Sticker",
|
|
6
|
+
description: "Sends a .webp sticker to you Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendsticker) for more information",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
telegramBotApi,
|
|
11
|
+
chatId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
telegramBotApi,
|
|
14
|
+
"chatId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
filename: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
telegramBotApi,
|
|
20
|
+
"filename",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
sticker: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
telegramBotApi,
|
|
26
|
+
"media",
|
|
27
|
+
],
|
|
28
|
+
label: "Sticker",
|
|
29
|
+
},
|
|
30
|
+
reply_to_message_id: {
|
|
31
|
+
propDefinition: [
|
|
32
|
+
telegramBotApi,
|
|
33
|
+
"reply_to_message_id",
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
reply_markup: {
|
|
37
|
+
propDefinition: [
|
|
38
|
+
telegramBotApi,
|
|
39
|
+
"reply_markup",
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
async run({ $ }) {
|
|
44
|
+
const resp = await this.telegramBotApi.sendSticker(this.chatId, this.sticker, {
|
|
45
|
+
reply_to_message_id: this.reply_to_message_id,
|
|
46
|
+
reply_markup: this.reply_markup,
|
|
47
|
+
filename: this.filename,
|
|
48
|
+
});
|
|
49
|
+
// eslint-disable-next-line multiline-ternary
|
|
50
|
+
$.export("$summary", `Successfully sent the sticker${this.fileName ? ` "${this.filename}"` : ""} to chat, "${this.chatId}"`);
|
|
51
|
+
return resp;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import telegramBotApi from "../../telegram_bot_api.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "telegram_bot_api-send-text-message-or-reply",
|
|
5
|
+
name: "Send a Text Message or Reply",
|
|
6
|
+
description: "Sends a text message or a reply to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendmessage) for more information",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
telegramBotApi,
|
|
11
|
+
chatId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
telegramBotApi,
|
|
14
|
+
"chatId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
text: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
telegramBotApi,
|
|
20
|
+
"text",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
parse_mode: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
telegramBotApi,
|
|
26
|
+
"parse_mode",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
disable_notification: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
telegramBotApi,
|
|
32
|
+
"disable_notification",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
disable_web_page_preview: {
|
|
36
|
+
propDefinition: [
|
|
37
|
+
telegramBotApi,
|
|
38
|
+
"disable_web_page_preview",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
reply_to_message_id: {
|
|
42
|
+
propDefinition: [
|
|
43
|
+
telegramBotApi,
|
|
44
|
+
"reply_to_message_id",
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
reply_markup: {
|
|
48
|
+
propDefinition: [
|
|
49
|
+
telegramBotApi,
|
|
50
|
+
"reply_markup",
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
async run({ $ }) {
|
|
55
|
+
const resp = await this.telegramBotApi.sendMessage(this.chatId, this.text, {
|
|
56
|
+
parse_mode: this.parse_mode,
|
|
57
|
+
disable_notification: this.disable_notification,
|
|
58
|
+
disable_web_page_preview: this.disable_web_page_preview,
|
|
59
|
+
reply_to_message_id: this.reply_to_message_id,
|
|
60
|
+
reply_markup: this.reply_markup,
|
|
61
|
+
});
|
|
62
|
+
// eslint-disable-next-line multiline-ternary
|
|
63
|
+
$.export("$summary", `Successfully sent a ${this.reply_to_message_id ? "reply" : "text message"} to chat, "${this.chatId}"`);
|
|
64
|
+
return resp;
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import telegramBotApi from "../../telegram_bot_api.app.mjs";
|
|
2
|
+
import contentTypes from "../../content-types.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "telegram_bot_api-send-video",
|
|
6
|
+
name: "Send a Video",
|
|
7
|
+
description: "Sends a video file to your Telegram Desktop application. [See the docs](https://core.telegram.org/bots/api#sendvideo) for more information",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
telegramBotApi,
|
|
12
|
+
chatId: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
telegramBotApi,
|
|
15
|
+
"chatId",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
caption: {
|
|
19
|
+
propDefinition: [
|
|
20
|
+
telegramBotApi,
|
|
21
|
+
"caption",
|
|
22
|
+
],
|
|
23
|
+
description: "Enter the video caption.",
|
|
24
|
+
},
|
|
25
|
+
filename: {
|
|
26
|
+
propDefinition: [
|
|
27
|
+
telegramBotApi,
|
|
28
|
+
"filename",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
video: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
telegramBotApi,
|
|
34
|
+
"media",
|
|
35
|
+
],
|
|
36
|
+
label: "Video",
|
|
37
|
+
},
|
|
38
|
+
contentType: {
|
|
39
|
+
propDefinition: [
|
|
40
|
+
telegramBotApi,
|
|
41
|
+
"contentType",
|
|
42
|
+
],
|
|
43
|
+
options: contentTypes.video,
|
|
44
|
+
},
|
|
45
|
+
duration: {
|
|
46
|
+
propDefinition: [
|
|
47
|
+
telegramBotApi,
|
|
48
|
+
"duration",
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
width: {
|
|
52
|
+
propDefinition: [
|
|
53
|
+
telegramBotApi,
|
|
54
|
+
"width",
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
height: {
|
|
58
|
+
propDefinition: [
|
|
59
|
+
telegramBotApi,
|
|
60
|
+
"height",
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
reply_markup: {
|
|
64
|
+
propDefinition: [
|
|
65
|
+
telegramBotApi,
|
|
66
|
+
"reply_markup",
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
async run({ $ }) {
|
|
71
|
+
const resp = await this.telegramBotApi.sendVideo(this.chatId, this.video, {
|
|
72
|
+
caption: this.caption,
|
|
73
|
+
parse_mode: this.parse_mode,
|
|
74
|
+
disable_notification: this.disable_notification,
|
|
75
|
+
duration: this.duration,
|
|
76
|
+
width: this.width,
|
|
77
|
+
height: this.height,
|
|
78
|
+
reply_markup: this.reply_markup,
|
|
79
|
+
filename: this.filename,
|
|
80
|
+
contentType: this.contentType,
|
|
81
|
+
});
|
|
82
|
+
// eslint-disable-next-line multiline-ternary
|
|
83
|
+
$.export("$summary", `Successfully sent the video${this.fileName ? ` "${this.filename}"` : ""} to chat, "${this.chatId}"`);
|
|
84
|
+
return resp;
|
|
85
|
+
},
|
|
86
|
+
};
|