1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-06-04 23:37:46 +02:00

113 lines
3.0 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 4
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Send audio
Sends an audio file to a chat or channel
`Function SendAudio(Val Token, Val ChatID, Val Text, Val Audio, Val Keyboard = "", Val Markup = "Markdown") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Bot token |
| ChatID | --chat | String, Number | ✔ | Target chat ID or ChatID*TopicID |
| Text | --text | String | ✔ | Message text |
| Audio | --audio | BinaryData, String | ✔ | Audio file |
| Keyboard | --keyboard | String | ✖ | Keyboard. See FormKeyboardFromButtonArray |
| Markup | --parsemode | String | ✖ | Text processing type (HTML, Markdown, MarkdownV2) |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
<br/>
:::tip
2024-10-29 17:14:45 +03:00
Method at API documentation: [sendAudio](https://core.telegram.org/bots/api#sendaudio)<br/>
2024-10-15 13:51:58 +03:00
Parameters with Binary data type can also accept file paths on disk and URLs
2024-10-15 10:16:04 +03:00
:::
<br/>
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-10-15 10:16:04 +03:00
Token = "6129457865:AAFyzNYOAFbu...";
ChatID = "461699897";
ChannelID = "@testsichee";
Text = "Строковое значение";
Audio = "https://api.athenaeum.digital/test_data/song.mp3";
AudioPath = GetTempFileName("mp3");
CopyFile(Audio, AudioPath);
AudioDD = New BinaryData(AudioPath);
Result = OPI_Telegram.SendAudio(Token, ChatID, Text, Audio);
Result = OPI_Telegram.SendAudio(Token, ChannelID, Text, AudioPath);
Result = OPI_Telegram.SendAudio(Token, ChannelID, Text, AudioDD);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint telegram SendAudio \
2024-10-22 08:59:24 +03:00
--token "***" \
--chat "@testsichee" \
--text "Строковое значение" \
2024-11-12 23:15:46 +03:00
--audio "C:\Users\Administrator\AppData\Local\Temp\ebo00szyahg.mp3"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint telegram SendAudio ^
2024-10-22 08:59:24 +03:00
--token "***" ^
--chat "@testsichee" ^
--text "Строковое значение" ^
2024-11-12 23:15:46 +03:00
--audio "C:\Users\Administrator\AppData\Local\Temp\ebo00szyahg.mp3"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"ok": true,
"result": {
"message_id": 8306,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": 461699897,
"first_name": "Anton",
"last_name": "Titowets",
"username": "JKIee",
"type": "private"
},
"date": 1728453355,
"audio": {
"duration": 228,
"file_name": "audio",
"mime_type": "audio/mpeg",
"title": "Dogs",
"performer": "Motorhead",
"file_id": "CQACAgIAAxkDAAIgcmcGGuszMgUnk-JaG65Sngu8yYGMAAJNWgAC_cg4SEo4WdCQr5DQNgQ",
"file_unique_id": "AgADTVoAAv3IOEg",
"file_size": 9229352
},
"caption": "Строковое значение"
}
}
```