1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-03-29 21:57:16 +02:00
Vitaly the Alpaca (bot) aab8f43a6e Main build (Jenkins)
2024-11-21 13:27:18 +03:00

209 lines
4.6 KiB
Plaintext

---
sidebar_position: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Get updates
Executes a request, returning information about bot events. Used in polling mode
`Function GetUpdates(Val Token, Val Timeout = 0, Val Offset = "") Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Bot token |
| Timeout | --timeout | String, Number | ✖ | Waiting time for new events |
| Offset | --offset | String, Number | ✖ | Offset in the list of received messages |
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
<br/>
:::tip
Method at API documentation: [getUpdates](https://core.telegram.org/bots/api#getupdates)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Token = "6129457865:AAFyzNYOAFbu...";
Result = OPI_Telegram.GetUpdates(Token);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint telegram GetUpdates \
--token "***"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint telegram GetUpdates ^
--token "***"
```
</TabItem>
</Tabs>
```json title="Result"
{
"ok": true,
"result": [
{
"update_id": 291369021,
"channel_post": {
"message_id": 9439,
"sender_chat": {
"id": -1001893407333,
"title": "Тестовый канал",
"username": "testsichee",
"type": "channel"
},
"chat": {
"id": -1001893407333,
"title": "Тестовый канал",
"username": "testsichee",
"type": "channel"
},
"date": 1728411383,
"pinned_message": {
"message_id": 9420,
"sender_chat": {
"id": -1001893407333,
"title": "Тестовый канал",
"username": "testsichee",
"type": "channel"
},
"chat": {
"id": -1001893407333,
"title": "Тестовый канал",
"username": "testsichee",
"type": "channel"
},
"date": 1728411163,
"text": "Строковое значение"
}
}
},
{
"update_id": 291369022,
"message": {
"message_id": 5396,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": -1001971186208,
"title": "Тест",
"is_forum": true,
"type": "supergroup"
},
"date": 1728411415,
"message_thread_id": 5396,
"forum_topic_created": {
"name": "TestTopic 8efb59a8-19c1-46f6-afb9-ceadd411e795",
"icon_color": 7322096,
"icon_custom_emoji_id": "5357419403325481346"
},
"is_topic_message": true
}
},
{
"update_id": 291369023,
"message": {
"message_id": 5398,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": -1001971186208,
"title": "Тест",
"is_forum": true,
"type": "supergroup"
},
"date": 1728411416,
"message_thread_id": 5396,
"reply_to_message": {
"message_id": 5396,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": -1001971186208,
"title": "Тест",
"is_forum": true,
"type": "supergroup"
},
"date": 1728411415,
"message_thread_id": 5396,
"forum_topic_created": {
"name": "TestTopic 8efb59a8-19c1-46f6-afb9-ceadd411e795",
"icon_color": 7322096,
"icon_custom_emoji_id": "5357419403325481346"
},
"is_topic_message": true
},
"forum_topic_edited": {
"name": "NewTestTitle",
"icon_custom_emoji_id": "5310132165583840589"
},
"is_topic_message": true
}
},
{
"update_id": 291369024,
"message": {
"message_id": 5399,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": -1001971186208,
"title": "Тест",
"is_forum": true,
"type": "supergroup"
},
"date": 1728411421,
"forum_topic_reopened": {}
}
},
{
"update_id": 291369025,
"message": {
"message_id": 5400,
"from": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"chat": {
"id": -1001971186208,
"title": "Тест",
"is_forum": true,
"type": "supergroup"
},
"date": 1728411421,
...
```