Exemplo n.º 1
0
 def do_wiki(self, tb, lang='fa'):
     if self.cheat_cat:  wiki = wikipedia().summary(self.cheat_input, lang=lang)
     else:               wiki = wikipedia().summary(self.command, lang='fa')
     if wiki[0] == 0:             return(0,  u'Wiki: %s' % wiki[1])
     elif wiki[0] in {-1, -2}:    return(-1, u'Wiki: %s' % wiki[1])
     else:
         tb.send_chat_action(self.message.from_user.id, 'typing')
         tb.reply_to(self.message, wiki[1])
         return(1, wiki[1])
     return(-1, 'Wiki: UnExpected Error')
Exemplo n.º 2
0
 def cheat_code_food(self, tb):
     food = nerd_database.iranian_foods().suggest()
     if food == 0 or food == None:    return (0, u'Cheat Code: %s' % self.cheat_cat)
     elif food == -1:                 return (-1, u'Cheat Code: %s' % self.cheat_cat)
     #there is a suggestion
     suggest = u'پیشنهاد من یک غذای ایرانی هست به اسم "%s"' % food
     wiki = wikipedia().summary(food)
     if wiki[0]: suggest += "\n\n" + wiki[1]
     tb.send_chat_action(self.message.from_user.id, 'typing')
     tb.reply_to(self.message, suggest)
     return (1, suggest)