From edaad8ba283b4e61692df69bfaf9c6fcde2a6283 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Tue, 27 Feb 2024 23:16:06 +0100 Subject: Look for message hash before index in ts_from_hash_or_index Otherwise a hash that's all digits can't be used without the $ prefix. Message hashes are always at least three characters, so even though this prevents using indexes that collides with a hash, I don't think it's a problem as such large indexes doesn't seem practical anyways. --- slack/slack_buffer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slack/slack_buffer.py b/slack/slack_buffer.py index f5db14a..4c88d4c 100644 --- a/slack/slack_buffer.py +++ b/slack/slack_buffer.py @@ -430,10 +430,13 @@ class SlackBuffer(ABC): ) -> Optional[SlackTs]: if not hash_or_index: return self.ts_from_index(1, message_filter) + ts_from_hash = self.ts_from_hash(hash_or_index) + if ts_from_hash is not None: + return ts_from_hash elif hash_or_index.isdigit(): return self.ts_from_index(int(hash_or_index), message_filter) else: - return self.ts_from_hash(hash_or_index) + return None async def post_message( self, -- cgit