From 507b9618f93bc864fe4516f7acf7e846e90da6b5 Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Tue, 15 Jan 2019 13:15:33 +0100 Subject: Fix 'wrong arguments for function "buffer_set"' When a "channel_joined" event is received (e.g. when joining channels from the web client, or when someone else makes you join the channel), update_from_message_json sets self.topic to the dict, but render_topic expects it to be a string. This is an inconsistency introduced by e64293b41573b5caad2ebf343d9a4397cef22a67. Let's keep the dict. Actually, using update_from_message_json at all seems like a bad idea... --- wee_slack.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wee_slack.py b/wee_slack.py index 3026198..35b33c1 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1373,7 +1373,7 @@ class SlackChannel(SlackChannelCommon): self.eventrouter = eventrouter self.slack_name = kwargs["name"] self.slack_purpose = kwargs.get("purpose", {"value": ""}) - self.topic = kwargs.get("topic", {}).get("value", "") + self.topic = kwargs.get("topic", {"value": ""}) self.identifier = kwargs["id"] self.last_read = SlackTS(kwargs.get("last_read", SlackTS())) self.channel_buffer = None @@ -1458,14 +1458,13 @@ class SlackChannel(SlackChannelCommon): def render_topic(self): if self.channel_buffer: - if self.topic != "": - topic = self.topic - else: + topic = self.topic['value'] + if topic == "": topic = self.slack_purpose['value'] w.buffer_set(self.channel_buffer, "title", topic) def set_topic(self, value): - self.topic = value + self.topic = {"value": value} self.render_topic() def update_from_message_json(self, message_json): @@ -1806,7 +1805,7 @@ class SlackDMChannel(SlackChannel): self.update_color() self.set_name(self.slack_name) if dmuser in users: - self.topic = create_user_status_string(users[dmuser].profile) + self.set_topic(create_user_status_string(users[dmuser].profile)) def set_related_server(self, team): super(SlackDMChannel, self).set_related_server(team) -- cgit