def test(): logger.info('Testing mode') from sys import argv argv = argv[1:] args = {'all': False, 'color': False, 'num_answers': 1, 'pos': 1, 'query': argv} result = howdoi_call(args) print(' ') print(result)
def howdoi(self, msg): content_type, chat_type, chat_id = telepot.glance(msg) msg['text'] = ' '.join(msg['text'].split()[1:]) logger.info("How do I received! [{}]".format(msg['text'])) self.bot.sendChatAction(chat_id, 'typing') args = {'all': True, 'color': False, 'num_answers': 1, 'pos': 1, 'query': msg['text']} try: result = howdoi_call(args) # result = self.escape_markdown(result) except ReadTimeoutError: result = 'Timeout finding some answer, sorry :(' except Exception as e: logger.critical(e) # self.sender.sendMessage(result, chat_id=chat_id) self.bot.sendMessage(chat_id, result)