Skip to content

Commit

Permalink
fix ChannelCache.update calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-williams committed Feb 9, 2024
1 parent bbbc0e2 commit d901cb7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions njsp/cli/slack/channel_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from os import makedirs, environ
from os.path import exists, dirname
from os.path import exists
from typing import Optional, Iterable, Callable

from slack_sdk import WebClient
Expand Down Expand Up @@ -143,7 +143,7 @@ def fetch_messages(self, limit: int = 1000):
msgs = resp.data['messages']
err(f'Slack: fetched {len(msgs)} messages')
for msg in msgs:
self.cache.update(self.channel, msg)
self.cache.update(msg)

def msg_kwargs(self, accid: str, text: str) -> dict:
return dict(
Expand Down Expand Up @@ -173,7 +173,7 @@ def post_msg(self, accid: str, text: str):
resp = self.client.chat_postMessage(**msg_kwargs)
msg = resp.data['message']
err(f"ACCID {accid}: sent message {msg['ts']}")
self.cache.update(self.channel, msg)
self.cache.update(msg)

def delete_msg(self, ts: str, accid: str):
self.client.chat_delete(channel=self.channel, ts=ts)
Expand All @@ -191,4 +191,4 @@ def update_msg(self, ts: str, accid: str, text: str):
if ts != new_ts:
raise RuntimeError(f"Message {ts} updated to {new_ts}")
new_msg['ts'] = ts # Not included in chat.update `message` payload
self.cache.update(self.channel, new_msg)
self.cache.update(new_msg)

0 comments on commit d901cb7

Please sign in to comment.