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)