当前位置: 首页>>代码示例>>Python>>正文


Python Updater.idle方法代码示例

本文整理汇总了Python中telegram.Updater.idle方法的典型用法代码示例。如果您正苦于以下问题:Python Updater.idle方法的具体用法?Python Updater.idle怎么用?Python Updater.idle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在telegram.Updater的用法示例。


在下文中一共展示了Updater.idle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    # Create the EventHandler and pass it your bot's token.
    updater = Updater(token)

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

    # on different commands - answer in Telegram
    dp.addTelegramCommandHandler("help", home)
    dp.addTelegramCommandHandler("start", home)
    dp.addTelegramCommandHandler("home", home)

    dp.addTelegramCommandHandler("botinfo", botinfo)

    dp.addTelegramCommandHandler("mensa", mensa)
    dp.addTelegramCommandHandler("aulastudio", aulastudio)
    dp.addTelegramCommandHandler("biblioteca", biblioteca)

    for command in commands:
        dp.addTelegramCommandHandler(command, replier)

    dp.addTelegramMessageHandler(position)

    dp.addErrorHandler(error)
    updater.start_polling()
    updater.idle()
开发者ID:mikexine,项目名称:univeronabot,代码行数:28,代码来源:bot.py

示例2: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    global logger
    # load the logging configuration
    real_path = os.path.dirname(os.path.realpath(__file__))
    logging.config.fileConfig(real_path + '/logging.ini')
    logger = logging.getLogger(__name__)

    # Get the dispatcher to register handlers
    updater = Updater(token="TOKEN")
    dp = updater.dispatcher

    # on different commands - answer in Telegram
    dp.addTelegramCommandHandler("start", start)
    dp.addTelegramCommandHandler("roll", Dice.roll)

    # log all errors
    dp.addErrorHandler(error)

    logger.info('Starting new bot')
    roll()
    # Start the Bot
    updater.start_polling()

    # Block until the you presses 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()
开发者ID:Ziul,项目名称:DeDBot,代码行数:29,代码来源:main.py

示例3: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    # Create the EventHandler and pass it your bot's token.
    updater = Updater("135342801:AAFaninNSzDkYU8UzonHeOhcu5fVaPlCC7Y")

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

    # on different commands - answer in Telegram
    dp.addTelegramCommandHandler("start", start)
    dp.addTelegramCommandHandler("help", help)

    # on noncommand i.e message - echo the message on Telegram
    dp.addTelegramMessageHandler(echo)

    # log all errors
    dp.addErrorHandler(error)

    # Start the Bot
    updater.start_polling()

    runloop()
    # Run the bot until the you presses 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()
开发者ID:prasenmsft,项目名称:whatsapp,代码行数:27,代码来源:telegram_layer.py

示例4: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    # Create the EventHandler and pass it your bot's token.
    updater = Updater(token)

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

    # on different commands - answer in Telegram
    dp.addTelegramCommandHandler("help", help)
    dp.addTelegramCommandHandler("start", home)
    dp.addTelegramCommandHandler("home", home)
    dp.addTelegramCommandHandler("price", price)
    dp.addTelegramCommandHandler("register", register)
    dp.addTelegramCommandHandler("balances", balances)
    dp.addTelegramCommandHandler("transactions", transactions)
    dp.addTelegramCommandHandler("trades", trades)
    dp.addTelegramCommandHandler("tickers", tickers)
    dp.addTelegramCommandHandler("discounts", discounts)
    dp.addTelegramCommandHandler("delete_keys", deleteKeys)
    dp.addTelegramCommandHandler("bitcoin_data", bitcoinData)
    dp.addTelegramCommandHandler("orders", orders)
    for fund in FUNDS:
        dp.addTelegramCommandHandler(('tr_' + fund), fundTrades)
        dp.addTelegramCommandHandler(('tick_' + fund), ticker)
        dp.addTelegramCommandHandler(('ord_'+fund), fundOrders)
    for currency in CURRENCIES:
        dp.addTelegramCommandHandler(('disc_' + currency), currDiscount)
    dp.addTelegramMessageHandler(signup)

    dp.addErrorHandler(error)
    updater.start_polling()
    updater.idle()
开发者ID:LombardIT,项目名称:TheRockBot,代码行数:34,代码来源:bot.py

示例5: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():

    cnf = loadConfig()
    TOKEN = cnf["token"]
    games = cnf["games"]
    print "games in: ", games

    # Create the EventHandler and pass it your bot's token.
    updater = Updater(TOKEN)

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

    # on different commands - answer in Telegram
    dp.addTelegramCommandHandler("start", start)
    dp.addTelegramCommandHandler("help", help)
    dp.addTelegramCommandHandler("list_games", ls_closure(cnf))
    dp.addTelegramCommandHandler("start_game", start_closure(cnf))
    dp.addTelegramCommandHandler("update", update_cmd)

    # on noncommand i.e message - echo the message on Telegram
    dp.addTelegramMessageHandler(process_message_closure(cnf))

    # log all errors
    dp.addErrorHandler(error)

    # Start the Bot
    updater.start_polling()

    # Run the bot until the you presses 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()
开发者ID:LuisAyuso,项目名称:TeleAdventure,代码行数:35,代码来源:__main__.py

示例6: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    # Create the EventHandler and pass it your bot's token.
    updater = Updater("166865409:AAGSAEVXHyP1NlQaDOj65z4F9OgX5sarpGg")

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

    # on different commands - answer in Telegram
    dp.addTelegramCommandHandler("boz", startHandler)
    dp.addTelegramCommandHandler("muto", stopHandler)
    dp.addTelegramCommandHandler("help", helpHandler)

    # on noncommand i.e message - send a proper message on Telegram
    dp.addTelegramMessageHandler(messageHandler)

    # log all errors
    dp.addErrorHandler(errorHandler)

    # Start the Bot
    updater.start_polling()

    # Run the bot until the you presses 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()
开发者ID:Firebird1993,项目名称:BozBot,代码行数:27,代码来源:main.py

示例7: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    """Main program"""
    # Create the EventHandler and pass it your bot's token.
    updater = Updater(token='KEY')

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

    # on different commands - answer in Telegram
    dispatcher.addTelegramCommandHandler('start', start)
    dispatcher.addTelegramCommandHandler('nuevavotacion', newpoll)
    dispatcher.addTelegramCommandHandler('respuesta', response)
    dispatcher.addTelegramCommandHandler('iniciovotacion', initpoll)
    dispatcher.addTelegramCommandHandler('finvotacion', endpoll)
    dispatcher.addUnknownTelegramCommandHandler(unknown)

    # on noncommand i.e message
    dispatcher.addTelegramMessageHandler(receiver)

    # Start the Bot
    updater.start_polling()

    # Run the bot until the you presses 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()
开发者ID:mjota,项目名称:VotaBot,代码行数:28,代码来源:main.py

示例8: IngressoRapidoBot

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
class IngressoRapidoBot(object):

    # Mapa de comandos -> funções de tratamento
    commands = {
        'start': start_handler,
	'eventosnodia': events_on_handler,
        'eventosem': events_at_handler,
        'eventosdotipo': events_type_handler,
        'busca': search_handler,
	'eventosnoperiodo': events_between_handler,
        'mais': more_handler,
        'shows': shows_handler,
        'festas': parties_handler,
        'cinema': cinema_handler,
        'esportes': sports_handler,
        'teatro': theater_handler
    }

    def __init__(self, token):
        self.updater = Updater(token=token)
        dispatcher = self.updater.dispatcher

        for cmd, cmd_handler in self.commands.iteritems():
            dispatcher.addTelegramCommandHandler(cmd, cmd_handler)

    def run(self):
        self.updater.start_polling()
        self.updater.idle()
开发者ID:thspinto,项目名称:TalkTechHackthon,代码行数:30,代码来源:irbot.py

示例9: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    # Create the EventHandler and pass it your bot's token.
    updater = Updater(private_conf.tokenid)

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

    # on different commands - answer in Telegram
    dp.addTelegramCommandHandler("start", start)
    dp.addTelegramCommandHandler("subscribe_op", subscribe_op)
    dp.addTelegramCommandHandler("help", help)
    dp.addTelegramCommandHandler("leeop",leeop)

    #run One Piece manga checker
    run_op(updater.bot)

    # on noncommand i.e message - echo the message on Telegram
    dp.addTelegramMessageHandler(echo)

    # log all errors
    dp.addErrorHandler(error)

    # Start the Bot
    updater.start_polling()

    # Run the bot until the you presses 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()
开发者ID:criado,项目名称:Comeisbot,代码行数:31,代码来源:comeisbot.py

示例10: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    # Create the EventHandler and pass it your bot's token.
    updater = Updater(settings.TG_API_KEY)

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

    # on different commands - answer in Telegram
    dp.addTelegramCommandHandler("start", start)
    dp.addTelegramCommandHandler("help", help)
    dp.addTelegramCommandHandler("on", cmd_on)
    dp.addTelegramCommandHandler("off", cmd_off)
    dp.addTelegramCommandHandler("check", cmd_check)

    # on noncommand i.e message - echo the message on Telegram
    dp.addTelegramMessageHandler(echo)

    # log all errors
    dp.addErrorHandler(error)

    # Start the Bot
    updater.start_polling()

    # Run the bot until the you presses 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()
开发者ID:jgargallo,项目名称:heating-telegram-bot,代码行数:29,代码来源:heatbot.py

示例11: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    """Defining the main function"""

    global JOB_QUEUE

    news.create_news_json()
    utils.load_subscribers_json()

    config = utils.get_configuration()
    token = config.get('API-KEYS', 'TelegramBot')
    debug = config.getboolean('UTILS', 'Debug')
    logger = utils.get_logger(debug)

    updater = Updater(token)
    JOB_QUEUE = updater.job_queue
    notify_news(updater.bot)
    dispatcher = updater.dispatcher

    dispatcher.addTelegramCommandHandler("start", start_command)
    dispatcher.addTelegramCommandHandler("help", help_command)
    dispatcher.addTelegramCommandHandler("news", news.news_command)
    dispatcher.addTelegramCommandHandler("newson", newson_command)
    dispatcher.addTelegramCommandHandler("newsoff", newsoff_command)
    dispatcher.addTelegramCommandHandler("prof", other_commands.prof_command)
    dispatcher.addTelegramCommandHandler("segreteria", other_commands.student_office_command)
    dispatcher.addTelegramCommandHandler("mensa", other_commands.canteen_command)
    dispatcher.addTelegramCommandHandler("adsu", other_commands.adsu_command)

    # For Testing only
    dispatcher.addTelegramCommandHandler("commands_keyboard", commands_keyboard)

    logger.info('Bot started')

    updater.start_polling()
    updater.idle()
开发者ID:bradparks,项目名称:UnivaqInformaticaBot,代码行数:37,代码来源:botcore.py

示例12: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    thread.start_new_thread(checkFlood, (2,))
    updater = Updater(botID)
    dp = updater.dispatcher
    dp.addTelegramCommandHandler("start", start)
    dp.addTelegramCommandHandler("google", google)
    dp.addErrorHandler(error)
    updater.start_polling()

    updater.idle()
开发者ID:ScottIskinder,项目名称:Google-search-bot-telegram,代码行数:12,代码来源:main.py

示例13: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    updater = Updater(TOKEN)
    # Get the dispatcher to register handlers
    dp = updater.dispatcher

    # Add handlers for Telegram commands
    for (name, f) in bot_functions.items():
        dp.addTelegramCommandHandler(name, f)

    dp.addTelegramMessageHandler(bank_name_answer_handler)
    updater.start_polling()
    updater.idle()
开发者ID:anamihale,项目名称:bot_service,代码行数:14,代码来源:main.py

示例14: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
    updater = Updater(token='TOKEN')
    dp = updater.dispatcher
    dp.addTelegramCommandHandler('start', start)
    dp.addTelegramCommandHandler('help', help)
    dp.addTelegramCommandHandler('log', log)
    dp.addTelegramCommandHandler('test', test)
    dp.addTelegramMessageHandler(echo)
    dp.addErrorHandler(error)

    updater.start_polling()
    updater.idle()
开发者ID:ilevn,项目名称:TBot,代码行数:14,代码来源:main.py

示例15: main

# 需要导入模块: from telegram import Updater [as 别名]
# 或者: from telegram.Updater import idle [as 别名]
def main():
	updater=Updater("136820376:AAFgZ66FHblXImb0m-QyHj5i4gZAQ-5sN_c")
	dp=updater.dispatcher
	dp.addTelegramCommandHandler("start", start)

	dp.addTelegramMessageHandler(startReturnThread)

	dp.addErrorHandler(error)

	updater.start_polling()

	updater.idle()
开发者ID:int0x191f2,项目名称:musicreturnbot,代码行数:14,代码来源:main.py


注:本文中的telegram.Updater.idle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。