Exemple #1
0
def main():
    # 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("1300652419:AAFTJbMj0meJYJWVx41P2Ki6Wbeh0p_kj-4", use_context=True)

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

    main_conv_handler = ConversationHandler(
        entry_points=[CommandHandler('select', mainMenu)],

        states={
            SELECTION: [MessageHandler(Filters.regex('^(First|Second|Third)$'), chose)]
            
        },

        fallbacks=[CommandHandler('end', end), CommandHandler('chose', chose)]
    )
    
    serverInfo_handler = ConversationHandler(entry_points=[CommandHandler('serverinfo', serverNameGet)],
    states={
        GETSERVERINFO:[MessageHandler(Filters.all(), serverInfoShow)]
        },
        fallbacks=[CommandHandler('end', end)])
    
    firstBot_conv_handler = ConversationHandler(
    entry_points = [CommandHandler("admessage", adMessage)],
    states = {
    LINK: [MessageHandler(Filters.text, getLink)],
    MESSAGE: [MessageHandler(Filters.text, getMessage)],
    BUTTON: [MessageHandler(Filters.text, getButton)]
    },
    
    fallbacks=[CommandHandler('end', end)]
                                                )

    dp.add_handler(main_conv_handler)
    dp.add_handler(firstBot_conv_handler)
    dp.add_handler(CommandHandler("active", active))
    #dp.add_handler(CommandHandler("send", send))
    #dp.add_handler(CommandHandler("adMessage", adMessage))

    # Start the Bot
    updater.start_polling()

    # Run the bot until you press Ctrl-C or the process receives SIGINT,
    # SIGTERM or SIGABRT. This should be used most of the time, since
    # start_polling() is non-blocking and will stop the bot gracefully.
    updater.idle()
 def test_filters_all(self, update):
     assert Filters.all(update)
Exemple #3
0
 def test_filters_all(self, message):
     assert Filters.all(message)
 def test_filters_all(self, message):
     assert Filters.all(message)