Add 'remove_empty' kwarg for commands, to strip out empty space
This commit is contained in:
parent
04ab018048
commit
02e76444d1
2 changed files with 8 additions and 2 deletions
|
@ -202,7 +202,8 @@ class Module(ModuleManager.BaseModule):
|
|||
"args_split"][0]
|
||||
event["target"].send_mode("-v", target)
|
||||
|
||||
@utils.hook("received.command.topic", min_args=1, channel_only=True)
|
||||
@utils.hook("received.command.topic", min_args=1, channel_only=True,
|
||||
remove_empty=False)
|
||||
def topic(self, event):
|
||||
"""
|
||||
:help: Set the topic in the current channel
|
||||
|
@ -210,7 +211,8 @@ class Module(ModuleManager.BaseModule):
|
|||
:require_mode: o
|
||||
"""
|
||||
event["target"].send_topic(event["args"])
|
||||
@utils.hook("received.command.tappend", min_args=1, channel_only=True)
|
||||
@utils.hook("received.command.tappend", min_args=1, channel_only=True,
|
||||
remove_empty=False)
|
||||
def tappend(self, event):
|
||||
"""
|
||||
:help: Append to the topic in the current channel
|
||||
|
|
|
@ -140,7 +140,11 @@ class Module(ModuleManager.BaseModule):
|
|||
stderr.write(returned).send()
|
||||
target.buffer.skip_next()
|
||||
return
|
||||
|
||||
args_split = event["message_split"][args_index:]
|
||||
if hook.kwargs.get("remove_empty", True):
|
||||
args_split = list(filter(None, args_split))
|
||||
|
||||
min_args = hook.kwargs.get("min_args")
|
||||
if min_args and len(args_split) < min_args:
|
||||
if "usage" in hook.kwargs:
|
||||
|
|
Loading…
Reference in a new issue