Skip to content
Extraits de code Groupes Projets
Valider e3b9780e rédigé par Loïc Wikle DUBARD's avatar Loïc Wikle DUBARD
Parcourir les fichiers

quizz test

parent 6b464098
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Fichier ajouté
......@@ -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
......
Aucun aperçu pour ce type de fichier
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter