createChatSubscriptionInviteLinkПоддерживается
Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.
broadcast channels only (supergroups → "method is available only for channels"); subscription_period 2592000, subscription_price 1–10000; runs messages.exportChatInvite(subscription_pricing) as the bot; subscribers pay via payments.sendStarsForm(inputInvoiceChatInviteSubscription), Stars go to the channel Stars balance; renewed every period by RunBotStarSubscriptionRenewals; cancelled/unpaid subscriptions expire and the member is removed (kick without ban); ChatInviteLink.subscription_period/subscription_price and ChatMemberMember.until_date projected everywhere
Параметры
@usernameПример запроса
curl "https://api.staticgram.top/bot$TOKEN/createChatSubscriptionInviteLink" \
-H "Content-Type: application/json" \
-d '{
"chat_id": 123456789,
"subscription_period": 1,
"subscription_price": 1
}'from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer
session = AiohttpSession(api=TelegramAPIServer.from_base("https://api.staticgram.top"))
bot = Bot(TOKEN, session=session)
result = await bot.create_chat_subscription_invite_link(
chat_id=123456789,
subscription_period=1,
subscription_price=1,
)const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/createChatSubscriptionInviteLink`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"subscription_period": 1,
"subscription_price": 1
}),
});
const data = await res.json();Ответ (ChatInviteLink)
{
"ok": true,
"result": {
"invite_link": "...",
"creator": {
"id": 1780243423,
"is_bot": true,
"first_name": "..."
},
"creates_join_request": true,
"is_primary": true,
"is_revoked": true
}
}