1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-03-27 21:48:56 +02:00
Vitaly the Alpaca (bot) 4de7fa4268 Main build (Jenkins)
2024-12-16 19:38:57 +03:00

115 lines
3.0 KiB
Plaintext

---
sidebar_position: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# 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`
| 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) |
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
<br/>
:::tip
Method at API documentation: [sendAudio](https://core.telegram.org/bots/api#sendaudio)
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
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);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint telegram SendAudio \
--token "***" \
--chat "@testsichee" \
--text "Строковое значение" \
--audio "C:\Users\Administrator\AppData\Local\Temp\upxd414dmji.mp3"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint telegram SendAudio ^
--token "***" ^
--chat "@testsichee" ^
--text "Строковое значение" ^
--audio "C:\Users\Administrator\AppData\Local\Temp\upxd414dmji.mp3"
```
</TabItem>
</Tabs>
```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": "Строковое значение"
}
}
```