tdlib / telegram-bot-api

Telegram Bot API server
https://core.telegram.org/bots
Boost Software License 1.0
3.2k stars 602 forks source link

Behavior of subscription links #628

Closed Bibo-Joshi closed 3 months ago

Bibo-Joshi commented 3 months ago

Hi there,

while implementing the API 7.9 changes in the python-telegram-bot library, I noticed two oddities on the behavior of create_chat_subscription_link.

First, the documented return value is ChatInviteLink. My observed behavior is that the returned object includes the fields subscription_period and subscription_price in addition to the fields documented for that class. If this intended behavior that users are supposed to rely on, I would welcome it if these attributes where added to the documentation.

Secondly, I noticed that in the app you can't create subscription invite links for public channels. However, create_chat_subscription_link can still be called and the return value does include the fields mentioned above. Still, clicking on the link will make you join the channel without having to pay anything. Personally, I would have expected create_chat_subscription_link to raise, e.g., a BadRequest: Cannot create subscription for public channels. I guess that this might more on the TG server side than the bot api side, but I still wanted to point it out.

Cheers!

levlam commented 3 months ago

Documentation was fixed and the missing fields were added to documentation.

It makes no sense to prohibit creation of subscription links for public chats. The chat can be converted to public or private any time after link creation anyway. The chat can also be private but publicly accessible via linked public supergroup for comments.

Bibo-Joshi commented 3 months ago

Thanks for the quick reaction:)