使用 pyTelegramBotAPI 库的 Python 电报机器人。想要在调用命令 /start@BotName 时将机器人添加到组中它如何与 bot @TrueMafiaBot 一起工作我该怎么做?
问问题
1005 次
2 回答
0
您可以使用以下链接并将其发送给用户:
t.me/BotUsername?startgroup=botstart
替换BotUsername
为您的机器人用户名,当用户单击链接时,他们的客户端将提示选择机器人应添加到的组。
于 2019-11-27T10:24:56.080 回答
0
我将机器人添加到按按钮分组的最终代码
@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)
于 2019-11-29T08:16:29.783 回答