diff --git a/__pycache__/auth_file.cpython-37.pyc b/__pycache__/auth_file.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28360a5124e9c7d5d00b5d2972729ecbc5bb32d5 Binary files /dev/null and b/__pycache__/auth_file.cpython-37.pyc differ diff --git a/bot.py b/bot.py index 29fbd4307358310017dc9b273be34785b030d704..e41360388fee6df2bace87eb144af8321d6156d2 100755 --- a/bot.py +++ b/bot.py @@ -26,11 +26,10 @@ class Bot(Client): if 'Ah' in message_object.text: self.sendLocalImage('images/ah.png', thread_id=thread_id, thread_type=thread_type) - to_send = Bot.tests(message_object.text, thread_id=thread_id, thread_type=thread_type, author_id=author_id, channel=self.fetchThreadInfo(thread_id)[thread_id].name) + to_send = self.tests(message_object.text, thread_id=thread_id, thread_type=thread_type, author_id=author_id, channel=self.fetchThreadInfo(thread_id)[thread_id].name) if (author_id != self.uid or 'BOT :' not in message_object.text) and to_send is not None: self.send(Message('BOT :' + to_send), thread_id=thread_id, thread_type=thread_type) - @classmethod def tests(self, texte, thread_id, thread_type, author_id, channel=''): if texte == '!help': help_text = 'Ce que je sais faire :\n \ @@ -53,25 +52,26 @@ class Bot(Client): !translate <phrase> ; <lang_source> ; <lang_dest>\n\ !about -> vas-y test-moi !\n' return help_text - if '!translate' in texte: + elif '!translate' in texte: texte = texte.replace('!translate ', '').split(' ; ') try: - translator.translate(text=texte[0], dest=texte[2], src=texte[1]) - except: + return translator.translate(text=texte[0], dest=texte[2], src=texte[1]).text + except Exception as e: + print(e) return 'Tiens j\'y arrive pas, Apparement, ça ne marche pas comme ça.' - if texte == '!useless': + elif texte == '!useless': return useless.useless() - if texte == '!nordpress': + elif texte == '!nordpress': return useless.nordpresse() - if texte == '!chuck': + elif texte == '!chuck': return useless.chuck() - if texte == '!philo': + elif texte == '!philo': return useless.genererSujet() - if texte == '!haddock': + elif texte == '!haddock': return useless.haddock() # renomer qqn - if '!rename' in texte: + elif '!rename' in texte: texte = texte.replace('!rename ', '').split(';') for user in self.fetchAllUsersFromThreads([thread_id]): if user.name == texte[0]: @@ -80,31 +80,31 @@ class Bot(Client): return random.choice(['T\'es sur de ton coup là ?', 'chais pas qui c\'est...']) # pour rigoler - if any(word.lower() in texte.lower() for word in Bot.what_liste): + elif any(word.lower() in texte.lower() for word in Bot.what_liste): return random.choice(Bot.what_liste) - if '!memes ' in texte: + elif '!memes ' in texte: texte = texte.replace('!memes ', '').split(' ; ') useless.memes(texte) self.sendLocalImage('meme.png', thread_id=thread_id, thread_type=thread_type) - if any(word.lower() in texte.lower() for word in ["let\'s go", "c'est parti", "go ", "allons "]): + elif any(word.lower() in texte.lower() for word in ["let\'s go", "c'est parti", "go ", "allons "]): return 'é zé bardi !' - if any(word.lower() in texte.lower() for word in ['noice ', 'nice ', 'ok']): + elif any(word.lower() in texte.lower() for word in ['noice ', 'nice ', 'ok']): self.send(Message(text="👍", emoji_size=EmojiSize.LARGE), thread_id=thread_id, thread_type=thread_type) # self.send(Message(emoji_size=EmojiSize.LARGE), thread_id=thread_id, thread_type=thread_type) - if '!kohlanta' in texte: + elif '!kohlanta' in texte: texte = texte.replace('!kohlanta ', '') return useless.kohlanta(texte, channel) - if texte == '!pipo': + elif texte == '!pipo': return useless.pipo('useless/pipotron.txt') - if texte == '!ping': + elif texte == '!ping': return 'Pong !' - if any(word.lower() in texte.lower() for word in Bot.ahah_liste): + elif any(word.lower() in texte.lower() for word in Bot.ahah_liste): return random.choice(Bot.ahah_liste) - if texte == '!rateau': + elif texte == '!rateau': return useless.getRateau() # petit jeu de quizz - if '!quizz' in texte: + elif '!quizz' in texte: if 'start' in texte: return quizz.start() if 'new' in texte: @@ -122,13 +122,17 @@ class Bot(Client): return quizz.get_round() if 'question' in texte: return quizz.get_question() - if '!q ' in texte: - personne = self.fetchUserInfo(author_id)[0].name + elif '!q ' in texte: + personne = self.fetchUserInfo(author_id)[author_id].name print(personne) return quizz.answer(texte.replace('!q ', ''), personne) + elif "!indice" in texte: + return quizz.indice() + elif "!scoreboard" in texte: + return quizz.scoreboard() # meteo - if '!meteo' in texte: + elif '!meteo' in texte: try: texte = texte.replace('!meteo ', '').split(' ; ') if len(texte) == 2: @@ -139,18 +143,18 @@ class Bot(Client): return 'Ousp, c\'est cassé...' # wikipédia - if '!wikipedia' in texte: + elif '!wikipedia' in texte: try: texte = texte.replace('!wikipedia ', '') return usefull.wiki(texte) except: return 'Ousp, j\'ai glissé chef...' - if '!maps' in texte: + elif '!maps' in texte: try: return usefull.maps(texte.replace('!maps ', '')) except: return 'Houston, on a un problème...' - if texte == '!about': + elif texte == '!about': return 'Hello, je suis A.N.U.B.I.S. A Not Usefull But Intelligent System, créé par le talentueux LawiK aka Wikle aka Cyborg aka Loïc Dub que je vénère !' return None diff --git a/useless/__pycache__/quizz.cpython-37.pyc b/useless/__pycache__/quizz.cpython-37.pyc index 35910c75677a4fcc860ecef6f6e0a8e3858c2472..d90b322f1984a5b32efec9a7a43ecd5ef0657ec0 100644 Binary files a/useless/__pycache__/quizz.cpython-37.pyc and b/useless/__pycache__/quizz.cpython-37.pyc differ