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

ajout de ahah/mdr/lol

parent d7570633
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -6,9 +6,12 @@ from getpass import getpass ...@@ -6,9 +6,12 @@ from getpass import getpass
from fbchat.models import * from fbchat.models import *
import useless import useless
import usefull import usefull
import random
class Bot(Client): 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): def onMessage(self, author_id, message_object, thread_id, thread_type, **kwargs):
self.markAsDelivered(thread_id, message_object.uid) self.markAsDelivered(thread_id, message_object.uid)
self.markAsRead(thread_id) self.markAsRead(thread_id)
...@@ -16,8 +19,8 @@ class Bot(Client): ...@@ -16,8 +19,8 @@ class Bot(Client):
log.info("{} from {} in {}".format(message_object, thread_id, thread_type.name)) 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) 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: if (author_id != self.uid or 'BOT :' 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) self.send(Message('BOT :' + to_send), thread_id=thread_id, thread_type=thread_type)
@classmethod @classmethod
def tests(self, texte, channel=''): def tests(self, texte, channel=''):
...@@ -35,6 +38,7 @@ class Bot(Client): ...@@ -35,6 +38,7 @@ class Bot(Client):
!kohlanta <nom>\n \ !kohlanta <nom>\n \
!rateau \n \ !rateau \n \
!maps <nom_du_lieu> <destination(facultatif)>, not yet fully fonctionnal\n \ !maps <nom_du_lieu> <destination(facultatif)>, not yet fully fonctionnal\n \
!ping \n\
!about -> vas-y test-moi !\n' !about -> vas-y test-moi !\n'
return help_text return help_text
if texte == '!useless': if texte == '!useless':
...@@ -52,6 +56,10 @@ class Bot(Client): ...@@ -52,6 +56,10 @@ class Bot(Client):
return useless.kohlanta(texte, channel) return useless.kohlanta(texte, channel)
if texte == '!pipo': if texte == '!pipo':
return useless.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': if texte == '!rateau':
return useless.getRateau() return useless.getRateau()
if '!meteo' in texte: if '!meteo' in texte:
......
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