You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-27 22:18:36 +02:00
121 lines
3.5 KiB
Plaintext
Vendored
121 lines
3.5 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 13
|
|
description: Replace message keyboard and other functions to work with Telegram in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
|
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Telegram]
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Replace message keyboard
|
|
Replaces the message keyboard with a new one
|
|
|
|
|
|
|
|
`Function ReplaceMessageKeyboard(Val Token, Val ChatID, Val MessageID, Val Keyboard) Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| Token | --token | String | ✔ | Token |
|
|
| ChatID | --chat | String, Number | ✔ | Target chat ID |
|
|
| MessageID | --message | String, Number | ✔ | ID of message to delete |
|
|
| Keyboard | --keyboard | String, Structure Of KeyAndValue | ✔ | Keyboard. See FormKeyboardFromButtonArray |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Method at API documentation: [editMessageReplyMarkup](https://core.telegram.org/bots/api#editmessagereplymarkup)
|
|
:::
|
|
<br/>
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
Token = "6129457865:AAFyzNYOAFbu...";
|
|
ChatID = "461699897";
|
|
MessageID = "17281";
|
|
|
|
ButtonArray = New Array;
|
|
ButtonArray.Add("New button 3");
|
|
ButtonArray.Add("New button 2");
|
|
ButtonArray.Add("New button 1");
|
|
|
|
Keyboard = OPI_Telegram.FormKeyboardFromButtonArray(ButtonArray, True, False);
|
|
|
|
Result = OPI_Telegram.ReplaceMessageKeyboard(Token, ChatID, MessageID, Keyboard);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
# JSON data can also be passed as a path to a .json file
|
|
|
|
oint telegram ReplaceMessageKeyboard \
|
|
--token "***" \
|
|
--chat "461699897" \
|
|
--message "17185" \
|
|
--keyboard "{'inline_keyboard':[[{'text':'New button 3','callback_data':'New button 3'},{'text':'New button 2','callback_data':'New button 2'},{'text':'New button 1','callback_data':'New button 1'}]],'rows':'1'}"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
:: JSON data can also be passed as a path to a .json file
|
|
|
|
oint telegram ReplaceMessageKeyboard ^
|
|
--token "***" ^
|
|
--chat "461699897" ^
|
|
--message "17185" ^
|
|
--keyboard "{'inline_keyboard':[[{'text':'New button 3','callback_data':'New button 3'},{'text':'New button 2','callback_data':'New button 2'},{'text':'New button 1','callback_data':'New button 1'}]],'rows':'1'}"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"ok": true,
|
|
"result": {
|
|
"message_id": 17185,
|
|
"from": {
|
|
"id": 6129457865,
|
|
"is_bot": true,
|
|
"first_name": "Бот Виталий",
|
|
"username": "sicheebot"
|
|
},
|
|
"chat": {
|
|
"id": 461699897,
|
|
"first_name": "Anton",
|
|
"last_name": "Titovets",
|
|
"username": "bayselonarrend",
|
|
"type": "private"
|
|
},
|
|
"date": 1760516108,
|
|
"edit_date": 1760516194,
|
|
"text": "Строковое значение",
|
|
"reply_markup": {
|
|
"inline_keyboard": [
|
|
[
|
|
{
|
|
"text": "New button 3",
|
|
"callback_data": "New button 3"
|
|
},
|
|
{
|
|
"text": "New button 2",
|
|
"callback_data": "New button 2"
|
|
},
|
|
{
|
|
"text": "New button 1",
|
|
"callback_data": "New button 1"
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|
|
}
|
|
```
|