Is it possible to delete the bot's username before the link, after selecting a chat: "@Bot https://t.me/Bot?start=1" is the message after selecting a chat. How can I remove everything before the link from it so that it becomes like this: “https://t.me/Bot?start=1”?
Function (Telebot library):
def switch(message):
markup = types.InlineKeyboardMarkup()
bot_name = bot.get_me().username
switch_button = types.InlineKeyboardButton(text='Try', switch_inline_query=ref_link.format(bot_name, message.chat.id))
markup.add(switch_button)
bot.send_message(message.chat.id, "Выбрать чат", reply_markup = markup)
I tried changing library to aiogram, but it didn`t work.
Solved using a regular URL:
ref_link = 'https://t.me/share/url?url=https://t.me/{}?start={}'\
@bot.message_handler(commands = ['invite'])
def inv(message):
markup = types.InlineKeyboardMarkup()
bot_name = bot.get_me().username
switch_button = types.InlineKeyboardButton(text='Пригласить друга', url=ref_link.format(bot_name, message.chat.id))
markup.add(switch_button)
bot.send_message(message.chat.id, "Выбрать чат", reply_markup = markup)