1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-25 12:24:39 +02:00
OpenIntegrations/docs/en/md/Telegram/Administration/Create-invitation-link.mdx
Vitaly the Alpaca (bot) 2e809b51b0 Main build (Jenkins)
2024-11-17 16:09:58 +03:00

94 lines
2.4 KiB
Plaintext

---
sidebar_position: 3
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Create invitation link
Creates a link for joining a closed chat
`Function CreateInvitationLink(Val Token, Val ChatID, Val Title = "", Val ExpirationDate = "", Val UserLimit = 0) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Bot token |
| ChatID | --chat | String, Number | ✔ | Target chat ID or ChatID*TopicID |
| Title | --title | String | ✖ | Invitation title |
| ExpirationDate | --expire | Date | ✖ | Link expiration date (permanent if not specified) |
| UserLimit | --limit | Number | ✖ | User limit (infinite if not specified) |
Returns: Map Of KeyAndValue - serialized JSON response from Telegram
<br/>
:::tip
Method at API documentation: [createChatInviteLink](https://core.telegram.org/bots/api#createchatinvitelink)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Token = "6129457865:AAFyzNYOAFbu...";
ChannelID = "@testsichee";
Day = 86400;
CurrentDate = OPI_Tools.GetCurrentDate();
Title = "Link " + String(CurrentDate);
Expiration = CurrentDate + Day;
UnixExpiration = OPI_Tools.UNIXTime(Expiration);
Result = OPI_Telegram.CreateInvitationLink(Token, ChannelID, Title, Expiration, 200);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint telegram CreateInvitationLink \
--token "***" \
--chat "@testsichee" \
--expire "2024-11-18T14:53:57.0789987" \
--title "Link 17.11.2024 14:53:57" \
--limit 200
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint telegram CreateInvitationLink ^
--token "***" ^
--chat "@testsichee" ^
--expire "2024-11-18T14:53:57.0789987" ^
--title "Link 17.11.2024 14:53:57" ^
--limit 200
```
</TabItem>
</Tabs>
```json title="Result"
{
"ok": true,
"result": {
"invite_link": "https://t.me/+hUgH4yjb_7wyZDBi",
"name": "Link 09.10.2024 8:58:10",
"creator": {
"id": 6129457865,
"is_bot": true,
"first_name": "Бот Виталий",
"username": "sicheebot"
},
"expire_date": 1728547090,
"member_limit": 200,
"creates_join_request": false,
"is_primary": false,
"is_revoked": false
}
}
```