|
4 | 4 | #include "backend/id_types.hpp" |
5 | 5 | #include "message_tracker.hpp" |
6 | 6 | #include "render/common.hpp" |
| 7 | +#include "utils/u8format.hpp" |
7 | 8 | #include "utils/utils.hpp" |
8 | 9 |
|
| 10 | +#include <boost/url/url.hpp> |
9 | 11 | #include <tgbot/types/InlineKeyboardButton.h> |
10 | 12 |
|
11 | 13 | #include <cstddef> |
@@ -39,11 +41,16 @@ void renderShareLinkMemberAddition( |
39 | 41 |
|
40 | 42 | auto inviteButton = std::make_shared<TgBot::InlineKeyboardButton>(); |
41 | 43 | inviteButton->text = utils::utf8str(u8"📤 Поделиться"); |
| 44 | + const std::string botAlias = bot.getUnderlying().getMe()->username; |
42 | 45 | const api::InvitationId hash = storageApi.inviteMember(userId, storageId); |
43 | | - const std::string telegramBotAlias = bot.getUnderlying().getMe()->username; |
44 | | - const std::string inviteText = "Нажми на ссылку, чтобы стать участником хранилища 🍱**" + storage.name + |
45 | | - "** в CookCookhNya!\nhttps://t.me/" + telegramBotAlias + "?start=invite_" + hash; |
46 | | - inviteButton->url = "https://t.me/share/url?url=" + inviteText; |
| 46 | + const std::string storageUrl = std::format("https://t.me/{}?start=invite_{}", botAlias, hash); |
| 47 | + const std::string shareText = utils::u8format( |
| 48 | + "{} **{}** {}", u8"Нажми на ссылку, чтобы стать участником хранилища 🍱", storage.name, "в CookCookhNya!"); |
| 49 | + |
| 50 | + boost::urls::url url{"https://t.me/share/url"}; |
| 51 | + url.params().append({"url", storageUrl}); |
| 52 | + url.params().append({"text", shareText}); |
| 53 | + inviteButton->url = url.buffer(); |
47 | 54 |
|
48 | 55 | keyboard[0].push_back(std::move(inviteButton)); |
49 | 56 | keyboard[1].push_back(makeCallbackButton(u8"↩️ Назад", "back")); |
|
0 commit comments