2024-06-05 12:19:46 +02:00
|
|
|
---
|
|
|
|
sidebar_position: 8
|
|
|
|
---
|
|
|
|
|
|
|
|
# Send location
|
|
|
|
Sends location by geographic latitude and longitude to a chat or channel
|
|
|
|
|
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
`Function SendLocation(Val Token, Val ChatID, Val Latitude, Val Longitude, Val Keyboard = "") Export`
|
2024-06-05 12:19:46 +02:00
|
|
|
|
2024-08-13 14:52:26 +02:00
|
|
|
| Parameter | CLI option | Type | Description |
|
|
|
|
|-|-|-|-|
|
|
|
|
| Token | --token | String | Bot token |
|
|
|
|
| ChatID | --chat | String, Number | Target chat ID or ChatID*TopicID |
|
|
|
|
| Latitude | --lat | String, Number | Geographic latitude |
|
|
|
|
| Longitude | --long | String, Number | Geographic longitude |
|
|
|
|
| Keyboard | --keyboard | String | Keyboard JSON or path to .json |
|
2024-06-05 12:19:46 +02:00
|
|
|
|
2024-08-13 14:52:26 +02:00
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - Serialized JSON response from Telegram
|
2024-06-05 12:19:46 +02:00
|
|
|
|
2024-07-10 13:05:58 +02:00
|
|
|
<br/>
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
```bsl title="Code example"
|
2024-08-13 14:52:26 +02:00
|
|
|
Token = FunctionParameters["Telegram_Token"];
|
|
|
|
ChatID = FunctionParameters["Telegram_ChatID"];
|
|
|
|
ChannelID = FunctionParameters["Telegram_ChannelID"];
|
|
|
|
Width = FunctionParameters["Lat"];
|
|
|
|
Longitude = FunctionParameters["Long"];
|
|
|
|
|
|
|
|
Result = OPI_Telegram.SendLocation(Token, ChatID, Width, Longitude);
|
|
|
|
|
|
|
|
OPI_TestDataRetrieval.WriteLog(Result, "SendLocation", "Telegram");
|
|
|
|
|
|
|
|
Result = OPI_Telegram.SendLocation(Token, ChannelID, Width, Longitude);
|
2024-06-05 12:19:46 +02:00
|
|
|
```
|
2024-08-13 14:52:26 +02:00
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
2024-08-13 14:52:26 +02:00
|
|
|
|
|
|
|
oint telegram SendLocation --token "6129457865:AAFyzNYOAFbu..." --chat "461699897" --lat %lat% --long "48.87373649724122" --keyboard %keyboard%
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-07-10 13:11:17 +02:00
|
|
|
{
|
2024-08-13 14:52:26 +02:00
|
|
|
"ok": true,
|
|
|
|
"result": {
|
|
|
|
"message_id": 4646,
|
|
|
|
"from": {
|
|
|
|
"id": 6129457865,
|
|
|
|
"is_bot": true,
|
|
|
|
"first_name": "Vitaly The Bot",
|
|
|
|
"username": "sicheebot"
|
|
|
|
},
|
|
|
|
"chat": {
|
|
|
|
"id": 461699897,
|
|
|
|
"first_name": "Anton",
|
|
|
|
"last_name": "Titowets",
|
|
|
|
"username": "JKIee",
|
|
|
|
"type": "private"
|
|
|
|
},
|
|
|
|
"date": 1717072442,
|
|
|
|
"location": {
|
|
|
|
"latitude": 48.873739,
|
|
|
|
"longitude": 48.873733
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-05 12:19:46 +02:00
|
|
|
```
|