diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2018-11-06 20:09:45 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-01-26 12:51:07 +0100 |
commit | 1055742e196ea1beb39835a41efdf9415ea20e26 (patch) | |
tree | 1c95519fa51c6bed18f5a8cb64f94719dd9a5265 /wee_slack.py | |
parent | e082f21903c9751253b0528088f8e27cbd536422 (diff) | |
download | wee-slack-1055742e196ea1beb39835a41efdf9415ea20e26.tar.gz |
Rename command callbacks to start with command_
This includes these commands in the help command. It also allows these
commands to be used with the /slack prefix.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/wee_slack.py b/wee_slack.py index 426deee..b6f23bb 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -3530,7 +3530,7 @@ def get_msg_from_id(channel, msg_id): @slack_buffer_required @utf8_decode -def thread_command_callback(data, current_buffer, args): +def command_thread(data, current_buffer, args): """ /thread <message_id> Open the thread for the message. @@ -3550,7 +3550,7 @@ def thread_command_callback(data, current_buffer, args): @slack_buffer_required @utf8_decode -def reply_command_callback(data, current_buffer, args): +def command_reply(data, current_buffer, args): """ /reply <count/message_id> <text> Reply in a thread on the message. Specify either the message id @@ -3579,7 +3579,7 @@ def reply_command_callback(data, current_buffer, args): @slack_buffer_required @utf8_decode -def rehistory_command_callback(data, current_buffer, args): +def command_rehistory(data, current_buffer, args): """ /rehistory Reload the history in the current channel. @@ -3592,7 +3592,7 @@ def rehistory_command_callback(data, current_buffer, args): @slack_buffer_required @utf8_decode -def hide_command_callback(data, current_buffer, args): +def command_hide(data, current_buffer, args): """ /hide Hide the current channel if it is marked as distracting. @@ -3868,7 +3868,7 @@ def command_back(data, current_buffer, args): @slack_buffer_required @utf8_decode -def label_command_callback(data, current_buffer, args): +def command_label(data, current_buffer, args): """ /label <name> Rename a thread buffer. Note that this is not permanent. It will only last @@ -3979,11 +3979,10 @@ def setup_hooks(): w.hook_command_run('/whois', 'whois_command_cb', '') for cmd in ['hide', 'label', 'rehistory', 'reply', 'thread']: - function_name = cmd + '_command_callback' - doc = globals()[function_name].__doc__.strip().split('\n', 1) + doc = EVENTROUTER.cmds[cmd].__doc__.strip().split('\n', 1) args = ' '.join(doc[0].split()[1:]) description = textwrap.dedent(doc[1]) - w.hook_command(cmd, description, args, '', '', function_name, '') + w.hook_command(cmd, description, args, '', '', 'command_' + cmd, '') w.hook_completion("nicks", "complete @-nicks for slack", "nick_completion_cb", "") w.hook_completion("emoji", "complete :emoji: for slack", "emoji_completion_cb", "") |