Hook factorisation ; add new hooks : default (same comportement has previous version) and one hook before any parsing

When calling a hook, passed parameters change according to associated data variable
This commit is contained in:
Némunaire 2012-08-22 21:05:33 +02:00
commit 7e20368c10
8 changed files with 109 additions and 63 deletions

View file

@ -8,7 +8,7 @@ from urllib.parse import quote
nemubotversion = 3.2
import module_states_file as xmlparser
import xmlparser
LANG = ["ar", "zh", "cz", "en", "fr", "gr", "it",
"ja", "ko", "pl", "pt", "ro", "es", "tr"]
@ -25,7 +25,7 @@ def load(context):
Hook(cmd_translate, "traduire"))
def cmd_translate(data, msg):
def cmd_translate(msg):
global LANG
startWord = 1
if msg.cmd[startWord] in LANG: