aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_conversation.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2024-02-09 18:49:24 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 13:01:40 +0100
commit1b495a4b9ab7742c50de247efa9101b1eac08ef7 (patch)
tree92f6057d6e7498572ed3f7fa7e80ebcc95842dc0 /slack/slack_conversation.py
parent2f3fa57090a01b2cf2020ee90cc3f542d1893ebe (diff)
downloadwee-slack-1b495a4b9ab7742c50de247efa9101b1eac08ef7.tar.gz
Don't call conversations.leave when closed from server
Diffstat (limited to 'slack/slack_conversation.py')
-rw-r--r--slack/slack_conversation.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py
index 6b27940..a87cb3f 100644
--- a/slack/slack_conversation.py
+++ b/slack/slack_conversation.py
@@ -726,18 +726,20 @@ class SlackConversation(SlackBuffer):
if last_read_line_ts and last_read_line_ts != self.last_read:
await self._api.conversations_mark(self, last_read_line_ts)
- async def _buffer_closed(self):
+ async def _buffer_close(
+ self, call_buffer_close: bool = False, update_server: bool = False
+ ):
+ await super()._buffer_close(call_buffer_close, update_server)
+
+ if shared.script_is_unloading:
+ return
+
if self.id in self.workspace.open_conversations:
del self.workspace.open_conversations[self.id]
- if self.type in ["im", "mpim"]:
- await self._api.conversations_close(self)
- def _buffer_close_cb(self, data: str, buffer: str) -> int:
- super()._buffer_close_cb(data, buffer)
- if shared.script_is_unloading:
- return weechat.WEECHAT_RC_OK
- run_async(self._buffer_closed())
- return weechat.WEECHAT_RC_OK
+ if update_server:
+ if self.type in ["im", "mpim"]:
+ await self._api.conversations_close(self)
_T = TypeVar("_T", bound=SlackConversation)