From 6ae3ad443106388e47320ac69d7a959faa194477 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Fri, 21 Apr 2023 01:18:54 +0200 Subject: Add info to get contents of a message Fixes #889 --- wee_slack.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'wee_slack.py') diff --git a/wee_slack.py b/wee_slack.py index 79e2dba..75bc3fe 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -6204,6 +6204,17 @@ def line_event_cb(data, signal, hashtable): return w.WEECHAT_RC_OK +@utf8_decode +def info_slack_message_cb(data, info_name, args): + current_channel = EVENTROUTER.weechat_controller.buffers.get(w.current_buffer()) + message = current_channel.message_from_hash_or_index(args) + + if not message: + print_message_not_found_error(args) + return "" + return message.render() + + @slack_buffer_required @utf8_decode def command_back(data, current_buffer, args): @@ -6449,6 +6460,14 @@ def setup_hooks(): w.hook_hsignal("slack_cursor_reply", "line_event_cb", "reply") w.hook_hsignal("slack_cursor_thread", "line_event_cb", "thread") + w.hook_info( + "slack_message", + "get contents of a slack message", + "id or count to the message", + "info_slack_message_cb", + "", + ) + # Hooks to fix/implement # w.hook_signal('buffer_opened', "buffer_opened_cb", "") # w.hook_signal('window_scrolled', "scrolled_cb", "") -- cgit