channel or nick required when creating a Response
This commit is contained in:
parent
4f27232fd4
commit
e1aff6c4cf
@ -51,10 +51,10 @@ def get_variable(name, msg=None):
|
|||||||
def cmd_set(msg):
|
def cmd_set(msg):
|
||||||
if len (msg.cmds) > 2:
|
if len (msg.cmds) > 2:
|
||||||
set_variable(msg.cmds[1], " ".join(msg.cmds[2:]), msg.nick)
|
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()
|
save()
|
||||||
return res
|
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")
|
@hook("cmd_hook", "listalias")
|
||||||
def cmd_listalias(msg):
|
def cmd_listalias(msg):
|
||||||
@ -174,7 +174,7 @@ def parseask(msg):
|
|||||||
alias["origin"] = result.group(3)
|
alias["origin"] = result.group(3)
|
||||||
alias["creator"] = msg.nick
|
alias["creator"] = msg.nick
|
||||||
DATAS.getNode("aliases").addChild(alias)
|
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()
|
save()
|
||||||
return res
|
return res
|
||||||
return None
|
return None
|
||||||
|
@ -51,7 +51,7 @@ class Response:
|
|||||||
if self.channel is None:
|
if self.channel is None:
|
||||||
if self.nick is not None:
|
if self.nick is not None:
|
||||||
return [ self.nick ]
|
return [ self.nick ]
|
||||||
return [ self.sender.split("!")[0] ]
|
return list()
|
||||||
elif isinstance(self.channel, list):
|
elif isinstance(self.channel, list):
|
||||||
return self.channel
|
return self.channel
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user