diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-27 23:16:06 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-27 23:16:06 +0100 |
commit | edaad8ba283b4e61692df69bfaf9c6fcde2a6283 (patch) | |
tree | bb9c534dd7a464c4577c7ba84704eeec2dede6e1 /slack/slack_buffer.py | |
parent | 1a1b8950b06a9c146caf85b4ae6aca14a58cc789 (diff) | |
download | wee-slack-edaad8ba283b4e61692df69bfaf9c6fcde2a6283.tar.gz |
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.
Diffstat (limited to 'slack/slack_buffer.py')
-rw-r--r-- | slack/slack_buffer.py | 5 |
1 files changed, 4 insertions, 1 deletions
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, |