diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-08-24 13:37:51 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-08-28 15:32:15 +0200 |
commit | 05911c67184f18c0635b8f16092b7dc273826a5a (patch) | |
tree | b6b28f694bd513377beaf000ec014b026a780b8f | |
parent | 0e597eed1c9917d34388650bb27476e2a7656977 (diff) | |
download | wee-slack-05911c67184f18c0635b8f16092b7dc273826a5a.tar.gz |
Move open thread to thread message method
-rw-r--r-- | wee_slack.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/wee_slack.py b/wee_slack.py index 4408480..843b7f8 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2124,6 +2124,12 @@ class SlackMessage(object): def __hash__(self): return hash(self.ts) + def open_thread(self, switch=False): + self.thread_channel = SlackThreadChannel(EVENTROUTER, self) + self.thread_channel.open() + if switch: + w.buffer_set(self.thread_channel.channel_buffer, "display", "1") + def render(self, force=False): text = render(self.message_json, self.team, self.channel, force) if (self.message_json.get('subtype') == 'me_message' and @@ -3398,12 +3404,7 @@ def thread_command_callback(data, current_buffer, args): pm = channel.messages[SlackTS(args[1])] except: pm = channel.hashed_messages[args[1]] - tc = SlackThreadChannel(EVENTROUTER, pm) - pm.thread_channel = tc - tc.open() - # tc.create_buffer() - if config.switch_buffer_on_join: - w.buffer_set(tc.channel_buffer, "display", "1") + pm.open_thread(switch=config.switch_buffer_on_join) return w.WEECHAT_RC_OK_EAT elif args[0] == '/reply': count = int(args[1]) |