def price_handler(bot, update, args): arg = ' '.join(args) if not arg: return help_handler(message) searcher = TB_Searcher(arg) try: logger.debug('Key word to search: [{}]'.format(arg)) update.message.reply_text( '最低:¥{:.2f}/最高:¥{:.2f}/平均:¥{:.2f}'.format(*searcher.price_tuple())) except: logger.exception('Fail to print prices') update.message.reply_text('Ooops, 臣妾做不到啊')
def search_handler(bot, update, args): arg = ' '.join(args) if not arg: return help_handler(bot, update) searcher = TB_Searcher(arg) try: logger.debug('Key word to search: [{}]'.format(arg)) update.message.reply_text('\n'.join( '{}: {}'.format(title, url) for title, url in searcher.list_items())) except: logger.exception('Fail to list items') update.message.reply_text('Ooops, 臣妾做不到啊')