Untitled

mail@pastecode.io avatar
unknown
python
4 years ago
1.1 kB
13
Indexable
Never
def start(update, context)

    keyboard_start = InlineKeyboardMarkup(inline_keyboard=[
                             [InlineKeyboardButton(text='button text', callback_data='tasto')],
                             ])
    update.message.reply_text( 'text',parse_mode= 'Markdown', reply_markup=keyboard_start)


def conversation():
    # Create the Updater and pass it your bot's token.
    # Make sure to set use_context=True to use the new context based callbacks
    # Post version 12 this will no longer be necessary
    updater = Updater(TOKEN, use_context=True)

    # Get the dispatcher to register handlers
    dp = updater.dispatcher

    conv_handler = ConversationHandler(
            entry_points=[CallbackQueryHandler(button, pattern='^tasto$')],
            states={
                ...........
            },
            fallbacks=[MessageHandler(Filters.regex('^cancel$'), cancel)],
            #fallbacks=[MessageHandler(Filters.command, cancel)],
        )
        
    dp.add_handler(CommandHandler('start', start))
    dp.add_handler(CallbackQueryHandler(start))
    dp.add_handler(conv_handler)
    updater.start_polling()