Auto-submit /start when paying for premium.

This commit is contained in:
John Preston 2022-05-23 15:45:22 +04:00
parent 1eccb34f86
commit ff030d0252
4 changed files with 10 additions and 2 deletions

View file

@ -1686,7 +1686,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_premium_summary_about_animated_userpics" = "Video avatars animated in chat lists and chats to allow for additional self-expression.";
"lng_premium_summary_bottom_subtitle" = "About Telegram Premium";
"lng_premium_summary_bottom_about" = "While the free version of Telegram already gives its users more than any other messaging application, **Telegram Premium** pushes its capabilities even further.\n\n**Telegram Premium** is a paid option, because most Premium Features require additional expenses from Telegram to third parties such as data center providers and server manufacturers. Contributions from **Telegram Premium** users allow us to cover such costs and also help Telegram stay free for everyone.";
"lng_premium_summary_button" = "Subscribe for {cost} per month.";
"lng_premium_summary_button" = "Subscribe for {cost} per month";
"lng_group_about_header" = "You have created a group.";
"lng_group_about_text" = "Groups can have:";

View file

@ -598,7 +598,12 @@ void StartPremiumPayment(
"premium_invoice_slug",
QString());
if (!username.isEmpty()) {
UrlClickHandler::Open("https://t.me/" + username + "?start=" + ref);
controller->showPeerByLink(Window::SessionNavigation::PeerByLinkInfo{
.usernameOrId = username,
.resolveType = Window::ResolveType::BotStart,
.startToken = ref,
.startAutoSubmit = true,
});
} else if (!slug.isEmpty()) {
UrlClickHandler::Open("https://t.me/$" + slug);
}

View file

@ -346,6 +346,8 @@ void SessionNavigation::showPeerByLinkResolved(
// Show specific posts only in channels / supergroups.
const auto msgId = peer->isChannel()
? info.messageId
: info.startAutoSubmit
? ShowAndStartBotMsgId
: ShowAtUnreadMsgId;
const auto attachBotUsername = info.attachBotUsername;
if (bot && bot->botInfo->startToken != info.startToken) {

View file

@ -193,6 +193,7 @@ public:
ResolveType resolveType = ResolveType::Default;
QString startToken;
ChatAdminRights startAdminRights;
bool startAutoSubmit = false;
QString attachBotUsername;
std::optional<QString> attachBotToggleCommand;
std::optional<QString> voicechatHash;