From 366310f05cebddec85f5805aaeb0c814ae80b13e Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sat, 26 Jan 2019 21:09:24 +0100 Subject: Print error if no args given to slack talk/join/query --- wee_slack.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'wee_slack.py') 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 [,[,...]]') + 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('#'))) -- cgit