diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-01-26 21:09:24 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-01-26 21:09:24 +0100 |
commit | 366310f05cebddec85f5805aaeb0c814ae80b13e (patch) | |
tree | 486736cbadc9816031d382c56d16bd1364b3eeaf | |
parent | 4e497cd5709f3b69f204fbca2c994a351bb0820c (diff) | |
download | wee-slack-366310f05cebddec85f5805aaeb0c814ae80b13e.tar.gz |
Print error if no args given to slack talk/join/query
-rw-r--r-- | wee_slack.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index 5634659..034d20c 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -3445,6 +3445,9 @@ def command_talk(data, current_buffer, args): Open a chat with the specified user(s). """ + if not args: + w.prnt('', 'Usage: /slack talk <user>[,<user2>[,<user3>...]]') + return w.WEECHAT_RC_ERROR return join_query_command_cb(data, current_buffer, '/query ' + args) @@ -3452,7 +3455,12 @@ def command_talk(data, current_buffer, args): @utf8_decode def join_query_command_cb(data, current_buffer, args): team = EVENTROUTER.weechat_controller.buffers[current_buffer].team - query = args.split(' ')[1] + split_args = args.split(' ', 1) + if len(split_args) < 2 or not split_args[1]: + w.prnt('', 'Too few arguments for command "{}" (help on command: /help {})' + .format(split_args[0], split_args[0].lstrip('/'))) + return w.WEECHAT_RC_OK_EAT + query = split_args[1] # Try finding the channel by name channel = team.channels.get(team.get_channel_map().get(query.lstrip('#'))) |