roboteo: simplify syntax
This commit is contained in:
parent
f2a7c7dc14
commit
3b7f470342
18
roboteo.py
18
roboteo.py
|
@ -210,18 +210,19 @@ class Robeo(sleekxmpp.ClientXMPP):
|
|||
"""
|
||||
if msg['mucnick'] == self.nick:
|
||||
return
|
||||
if not msg['body'].startswith(('%s:' % self.nick, '@%s' % self.nick)):
|
||||
if not msg['body'].startswith(('%s:' % self.nick, '@%s' % self.nick,
|
||||
'%s,' % self.nick, '%s ' % self.nick)):
|
||||
return
|
||||
msg = msg['body'][len(self.nick)+1:].strip().lower()
|
||||
|
||||
words = msg.split()
|
||||
|
||||
if 'h' in words or '?' in words or 'help' in words or 'aide' in words or 'sos' in words:
|
||||
self.help()
|
||||
elif 'refr' in msg or 'rafr' in msg:
|
||||
if 'cal' in words or 'calendrier' in words or 'calendar' in words:
|
||||
self.show_events(force_update=True)
|
||||
elif 'rappel' in msg or 'remind' in msg:
|
||||
elif 'rappel' in words:
|
||||
self.show_events(force_update=False)
|
||||
else:
|
||||
self.help()
|
||||
|
||||
def muc_online(self, presence):
|
||||
"""
|
||||
|
@ -243,10 +244,9 @@ class Robeo(sleekxmpp.ClientXMPP):
|
|||
|
||||
def help(self):
|
||||
message = '''
|
||||
refr* | rafr* : recharge les rendez-vous du jour
|
||||
rappel* | remind* : affiche les rendez-vous en cache
|
||||
aide | sos | help | ? : cette aide
|
||||
n'importe quoi d'autre : ne fait rien du tout
|
||||
calendrier : recharge les rendez-vous du jour
|
||||
rappel : affiche les rendez-vous en cache
|
||||
n'importe quoi d'autre : cette aide
|
||||
'''
|
||||
self.send_message(mto=self.room,
|
||||
mbody=message,
|
||||
|
|
Reference in New Issue