Legacy hooks now need to be explicitely declared

This commit is contained in:
nemunaire 2014-08-28 18:05:21 +02:00
parent da32ee6490
commit 4b9a6305d4
7 changed files with 10 additions and 2 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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)

View File

@ -54,7 +54,7 @@ def cmd_subreddit(msg):
return all_res
@hook("msg_default")
def parselisten(msg):
global LAST_SUBS

View File

@ -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<user>[0-9]{7,})", re.IGNORECASE)
apikey_ask = re.compile(r"(clef|key|password|mot de passe?)\s+(?:est|is)?\s+(?P<key>[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 (

View File

@ -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<city>.*\w)\s*(?:(?:se|est)\s+(?:trouve|situ[ée]*)\s+[aà])\s*(?P<lat>-?[0-9]+(?:[,.][0-9]+))[^0-9.](?P<long>-?[0-9]+(?:[,.][0-9]+))\s*$", re.IGNORECASE)
@hook("ask_default")
def parseask(msg):
res = gps_ask.match(msg.content)
if res is not None:

View File

@ -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: