From e3b9780e42cdb8493bb2118ef07f96164084e37e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Wikle=20DUBARD?= <loic97429@gmail.com> Date: Mon, 19 Aug 2019 18:31:02 +0200 Subject: [PATCH] quizz test --- __pycache__/auth_file.cpython-37.pyc | Bin 0 -> 199 bytes bot.py | 58 ++++++++++++----------- useless/__pycache__/quizz.cpython-37.pyc | Bin 3579 -> 3859 bytes 3 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 __pycache__/auth_file.cpython-37.pyc diff --git a/__pycache__/auth_file.cpython-37.pyc b/__pycache__/auth_file.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28360a5124e9c7d5d00b5d2972729ecbc5bb32d5 GIT binary patch literal 199 zcmZ?b<>g{vU|_JXj*9hSU|@I*;=nK?0|SEt0|P@b4+8^33PTh_3S$&w3R5tHCUcc& zQhrHdUTIQhv5}EOdTwH7j$U$pZWX6PUTKnNv8B0*pC;2Sj?iG&AU{W6*IOI`j={m< z{y{D)8H$)07$C$iWBsE1{1Sba{N&Qy)Vz{n{eU2UFIVS~VEv^065ZU?;^Nf2^wc8# h#L|+C__WNNRK0@ATO2mI`6;D2sdh{tr-29-MgTlwGW`Gm literal 0 HcmV?d00001 diff --git a/bot.py b/bot.py index 29fbd43..e413603 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 GIT binary patch delta 1058 zcmew@Jz0*=iI<m)fq{X6cWYGabAgF`5{$<tsw;D(Fr+Z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