我需要从用户消息中获取数据

问题描述 投票:0回答:0

def 开始(更新,上下文): 打印(1) 键盘 = [[InlineKeyboardButton('Алгебра',callback_data = '1'), InlineKeyboardButton('Γеометрия',callback_data = '2')], [InlineKeyboardButton('Физика',callback_data = '3'), InlineKeyboardButton('Русский язык',callback_data = '4')]] update.message.reply_text('Выберите предмет', reply_markup = InlineKeyboardMarkup(keyboard))

def 按钮(更新,上下文): 打印(1) 查询 = update.callback_query 查询.answer() #query.data - это строка 如果 query.data == "1": number_chapter = '' 而 number_chapter == '': 打印(2) context.bot.send_message(update.effective_chat.id, 'Введите номер главы') 打印(3) number_chapter = str(update.message.from_user) #number_chapter = str((update.message.from_user) + context.args[0]) #number_chapter = str(update.message.from_user['消息']) 打印(数字_章节)

`我试过了#number_chapter = str((update.message.from_user) + context.args[0]) #number_chapter = str(update.message.from_user['message'])

但它不起作用`

python user-input telegram-bot
© www.soinside.com 2019 - 2024. All rights reserved.