From 674039083ec1ed0a0276998bcb6d2e4bf9ca435e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Wikle=20DUBARD?= <loic97429@gmail.com>
Date: Mon, 19 Aug 2019 12:16:15 +0200
Subject: [PATCH] ajout de ahah/mdr/lol

---
 bot.py           | 12 ++++++++++--
 requirements.txt |  3 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/bot.py b/bot.py
index 24051d4..1ebd866 100755
--- a/bot.py
+++ b/bot.py
@@ -6,9 +6,12 @@ from getpass import getpass
 from fbchat.models import *
 import useless
 import usefull
+import random
 
 
 class Bot(Client):
+    ahah_liste = ['ahah', 'mdr', 'lol', 'Mort de rire !', 'Trop marrant', 'tu m\'as tué', 'xD', 'PTDR']
+
     def onMessage(self, author_id, message_object, thread_id, thread_type, **kwargs):
         self.markAsDelivered(thread_id, message_object.uid)
         self.markAsRead(thread_id)
@@ -16,8 +19,8 @@ class Bot(Client):
         log.info("{} from {} in {}".format(message_object, thread_id, thread_type.name))
 
         to_send = Bot.tests(message_object.text, self.fetchThreadInfo(thread_id)[thread_id].name)
-        if (author_id != self.uid or 'A.N.U.B.I.S. :' not in message_object.text) and to_send is not None:
-            self.send(Message('A.N.U.B.I.S. :' + to_send), thread_id=thread_id, thread_type=thread_type)
+        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, channel=''):
@@ -35,6 +38,7 @@ class Bot(Client):
             !kohlanta <nom>\n \
             !rateau \n \
             !maps <nom_du_lieu> <destination(facultatif)>, not yet fully fonctionnal\n \
+            !ping \n\
             !about -> vas-y test-moi !\n'
             return help_text
         if texte == '!useless':
@@ -52,6 +56,10 @@ class Bot(Client):
             return useless.kohlanta(texte, channel)
         if texte == '!pipo':
             return useless.pipo()
+        if texte == '!ping':
+            return 'Pong !'
+        if any(word.lower() in texte.lower() for word in Bot.ahah_liste):
+            return random.choice(Bot.ahah_liste)
         if texte == '!rateau':
             return useless.getRateau()
         if '!meteo' in texte:
diff --git a/requirements.txt b/requirements.txt
index 625bdc8..7a3fb23 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,4 @@
 requests
 fbchat
-wikipedia
\ No newline at end of file
+wikipedia
+googletrans
\ No newline at end of file
-- 
GitLab