skip to Main Content

Telegram bot on python using the pyTelegramBotAPI library.
Want to add a bot to a group when calling the command /start@BotName how does it work with bot @TrueMafiaBot
How i can do this?

2

Answers


  1. Chosen as BEST ANSWER

    My final code for add bot to group by button

    @bot.message_handler(commands=['start', 'help'])
    def start_message(message):
        keyboard = types.InlineKeyboardMarkup()  # Keyboard
        key_add_to_group = types.InlineKeyboardButton(text='Add to group', url='http://t.me/evil_cards_bot?startgroup=test')
        keyboard.add(key_add_to_group)  # Add button to keyboard
        response_text = 'Add bot to group.'
        bot.send_message(message.chat.id, text=response_text, reply_markup=keyboard)
    

  2. You can use the following link and send it to the user:

    t.me/BotUsername?startgroup=botstart

    Replace BotUsername with your bots username and when the User clicks the link their client will prompt to select a group the bot should be added to.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search