wee-slack: Latest master does not load messages

Hi. With the current latest commit on master, the messages do not load. No messages are in the slack-debug buffer, but there are the following errors in the core buffer:

Error: a buffer with same name (url.slack.com.#channel) already exists
# […] a bunch of other errors "a buffer with same name…"
Connected to Slack team adgear (url.slack.com) with username antoyo
python: stdout/stderr (slack): Traceback (most recent call last):
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 630, in handle_next
python: stdout/stderr (slack):     EVENTROUTER.handle_next()
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 618, in handle_next
python: stdout/stderr (slack):     self.handlers[function_name](j, self, **kwargs)
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 2764, in handle_conversationsmembers
python: stdout/stderr (slack):     channel.members = set(members_json['members'])
python: stdout/stderr (slack): KeyError: u'members'
python: stdout/stderr (slack): Traceback (most recent call last):
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 630, in handle_next
python: stdout/stderr (slack):     EVENTROUTER.handle_next()
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 618, in handle_next
python: stdout/stderr (slack):     self.handlers[function_name](j, self, **kwargs)
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 2764, in handle_conversationsmembers
python: stdout/stderr (slack):     channel.members = set(members_json['members'])
python: stdout/stderr (slack): KeyError: u'members'
python: stdout/stderr (slack): Traceback (most recent call last):
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 630, in handle_next
python: stdout/stderr (slack):     EVENTROUTER.handle_next()
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 618, in handle_next
python: stdout/stderr (slack):     self.handlers[function_name](j, self, **kwargs)
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 2764, in handle_conversationsmembers
python: stdout/stderr (slack):     channel.members = set(members_json['members'])
python: stdout/stderr (slack): KeyError: u'members'
python: stdout/stderr (slack): Traceback (most recent call last):
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 630, in handle_next
python: stdout/stderr (slack):     EVENTROUTER.handle_next()
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 618, in handle_next
python: stdout/stderr (slack):     self.handlers[function_name](j, self, **kwargs)
python: stdout/stderr (slack):   File "/home/antoyo/.weechat/python/autoload/wee_slack.py", line 2764, in handle_conversationsmembers
python: stdout/stderr (slack):     channel.members = set(members_json['members'])
python: stdout/stderr (slack): KeyError: u'members'

Thanks to fix the issue.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve been having a similar issue lately, very often in threads. “Error: A buffer with the same name (…) already exists” in the weechat core window. It seems to happen quite randomly, but when this happens, I will no longer receive any new incoming message in this thread. Closing the buffer means I can never reopen it again 😕

This has now been fixed.

I’m using this workaround to avoid it:

diff --git a/wee_slack.py b/wee_slack.py
index d42bc7b..84b9629 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2253,8 +2253,9 @@ class SlackThreadChannel(SlackChannelCommon):
 
     def open(self, update_remote=True):
         self.create_buffer()
-        self.active = True
-        self.get_history()
+        if self.channel_buffer:
+            self.active = True
+            self.get_history()
         # if "info" in SLACK_API_TRANSLATOR[self.type]:
         #    s = SlackRequest(self.team.token, SLACK_API_TRANSLATOR[self.type]["info"], {"name": self.identifier}, team_hash=self.team.team_hash, channel_identifier=self.identifier)
         #    self.eventrouter.receive(s)
@@ -2273,6 +2274,8 @@ class SlackThreadChannel(SlackChannelCommon):
         """
         if not self.channel_buffer:
             self.channel_buffer = w.buffer_new(self.formatted_name(style="long_default"), "buffer_input_callback", "EVENTROUTER", "", "")
+            if not self.channel_buffer:
+                self.channel_buffer = w.buffer_search("python", self.formatted_name(style="long_default"))
             self.eventrouter.weechat_controller.register_buffer(self.channel_buffer, self)
             w.buffer_set(self.channel_buffer, "localvar_set_type", 'channel')
             w.buffer_set(self.channel_buffer, "localvar_set_nick", self.team.nick)

It avoids the issue of losing messages and buffers, but it has some annoying drawbacks (duplicating all the messages when he fetches history, or merging threads when they happen to share the same hash), that’s why I don’t propose it as a PR yet.

Hi,

I’ve been having a similar issue lately, very often in threads. “Error: A buffer with the same name (…) already exists” in the weechat core window. It seems to happen quite randomly, but when this happens, I will no longer receive any new incoming message in this thread. Closing the buffer means I can never reopen it again 😕

Thanks!