channel or nick required when creating a Response

This commit is contained in:
nemunaire 2014-11-12 23:50:48 +01:00
parent 4f27232fd4
commit e1aff6c4cf
2 changed files with 4 additions and 4 deletions

View File

@ -51,10 +51,10 @@ def get_variable(name, msg=None):
def cmd_set(msg):
if len (msg.cmds) > 2:
set_variable(msg.cmds[1], " ".join(msg.cmds[2:]), msg.nick)
res = Response("Variable \$%s définie." % msg.cmds[1])
res = Response("Variable \$%s définie." % msg.cmds[1], channel=msg.channel)
save()
return res
return Response("!set prend au minimum deux arguments : le nom de la variable et sa valeur.")
return Response("!set prend au minimum deux arguments : le nom de la variable et sa valeur.", channel=msg.channel)
@hook("cmd_hook", "listalias")
def cmd_listalias(msg):
@ -174,7 +174,7 @@ def parseask(msg):
alias["origin"] = result.group(3)
alias["creator"] = msg.nick
DATAS.getNode("aliases").addChild(alias)
res = Response("Nouvel alias %s défini avec succès." % result.group(1))
res = Response("Nouvel alias %s défini avec succès." % result.group(1), channel=msg.channel)
save()
return res
return None

View File

@ -51,7 +51,7 @@ class Response:
if self.channel is None:
if self.nick is not None:
return [ self.nick ]
return [ self.sender.split("!")[0] ]
return list()
elif isinstance(self.channel, list):
return self.channel
else: