diff --git a/modules/alias.py b/modules/alias.py index 7d83d3b..6eb8501 100644 --- a/modules/alias.py +++ b/modules/alias.py @@ -171,7 +171,7 @@ def treat_alias(msg, hooks_cache): return False return False - +@hook("ask_default") def parseask(msg): global ALIAS if re.match(".*(set|cr[ée]{2}|nouvel(le)?) alias.*", msg.content) is not None: diff --git a/modules/birthday.py b/modules/birthday.py index cfb2ffa..1473091 100644 --- a/modules/birthday.py +++ b/modules/birthday.py @@ -82,6 +82,7 @@ def cmd_age(msg): " Quand est-il né ?" % name, msg.channel, msg.nick) return True +@hook("ask_default") def parseask(msg): res = re.match(r"^(\S+)\s*('s|suis|est|is|was|were)?\s+(birthday|geburtstag|née? |nee? le|born on).*$", msg.content, re.I) if res is not None: diff --git a/modules/events.py b/modules/events.py index 5a745fb..e14b3d2 100644 --- a/modules/events.py +++ b/modules/events.py @@ -166,6 +166,7 @@ def liste(msg): else: return Response(msg.sender, "Compteurs connus : %s." % ", ".join(DATAS.index.keys()), channel=msg.channel) +@hook("cmd_default") def parseanswer(msg): if msg.cmds[0] in DATAS.index: res = Response(msg.sender, channel=msg.channel) @@ -185,6 +186,7 @@ def parseanswer(msg): RGXP_ask = re.compile(r"^.*((create|new)\s+(a|an|a\s*new|an\s*other)?\s*(events?|commande?)|(nouvel(le)?|ajoute|cr[ée]{1,3})\s+(un)?\s*([eé]v[ée]nements?|commande?)).*$", re.I) +@hook("ask_default") def parseask(msg): if RGXP_ask.match(msg.content) is not None: name = re.match("^.*!([^ \"'@!]+).*$", msg.content) diff --git a/modules/reddit.py b/modules/reddit.py index 62b01ab..7789540 100644 --- a/modules/reddit.py +++ b/modules/reddit.py @@ -54,7 +54,7 @@ def cmd_subreddit(msg): return all_res - +@hook("msg_default") def parselisten(msg): global LAST_SUBS diff --git a/modules/sms.py b/modules/sms.py index a0cfeba..48e9da2 100644 --- a/modules/sms.py +++ b/modules/sms.py @@ -76,6 +76,7 @@ def cmd_sms(msg): apiuser_ask = re.compile(r"(utilisateur|user|numéro|numero|compte|abonne|abone|abonné|account)\s+(est|is)\s+(?P[0-9]{7,})", re.IGNORECASE) apikey_ask = re.compile(r"(clef|key|password|mot de passe?)\s+(?:est|is)?\s+(?P[a-zA-Z0-9]{10,})", re.IGNORECASE) +@hook("ask_default") def parseask(msg): if msg.content.find("Free") >= 0 and ( msg.content.find("API") >= 0 or msg.content.find("api") >= 0) and ( diff --git a/modules/weather.py b/modules/weather.py index cbb11b7..dab0509 100644 --- a/modules/weather.py +++ b/modules/weather.py @@ -8,6 +8,8 @@ import re from urllib.parse import quote from urllib.request import urlopen +from hooks import hook + import mapquest nemubotversion = 3.4 @@ -208,6 +210,7 @@ def cmd_weather(msg): gps_ask = re.compile(r"^\s*(?P.*\w)\s*(?:(?:se|est)\s+(?:trouve|situ[ée]*)\s+[aà])\s*(?P-?[0-9]+(?:[,.][0-9]+))[^0-9.](?P-?[0-9]+(?:[,.][0-9]+))\s*$", re.IGNORECASE) +@hook("ask_default") def parseask(msg): res = gps_ask.match(msg.content) if res is not None: diff --git a/modules/ycc.py b/modules/ycc.py index fb2208e..d653ccb 100644 --- a/modules/ycc.py +++ b/modules/ycc.py @@ -51,6 +51,7 @@ def cmd_ycc(msg): res.append(gen_response(False, msg, url)) return res +@hook("msg_default") def parselisten(msg): global LAST_URLS try: