Skip to content

Commit

Permalink
Revert "In this version, result.get("messages", []) is used to safely…
Browse files Browse the repository at this point in the history
… retrieve the messages list or an empty list if messages is not present. Similarly, result.get("response_metadata", {}).get("next_cursor") is used to safely check for the presence of next_cursor within response_metadata."

This reverts commit f5f2ce9.
  • Loading branch information
algapster committed Jun 17, 2024
1 parent f5f2ce9 commit 2d49939
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions slacker/slacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def read_channel(client, channel_id, rss_type, pages_to_read):
try:
conversation_history = []
result = client.conversations_history(channel=channel_id)
conversation_history.extend(result.get ("message",[])
conversation_history.extend(result["messages"])

while result.get("response_metadata",{}).get("next_cursor") and pages_to_read > 0:
while result["response_metadata"]["next_cursor"] is not None and pages_to_read > 0:
result = client.conversations_history(channel=channel_id, cursor=result["response_metadata"]["next_cursor"])
conversation_history.extend(result.get("messages", []))
conversation_history.extend(result["messages"])
pages_to_read = pages_to_read - 1

# Process extracted messages to find links and MD5 hashes
Expand Down

0 comments on commit 2d49939

Please sign in to comment.