service: Add absolute ID as argument to get command
patch 9c73d6fcff003a7d9b4f5f90df4f6dc71d84ae9d
Author: E. Bosch <presidev@AT@gmail.com>
Date: Tue Nov 28 22:38:01 CET 2023
* service: Add absolute ID as argument to get command
diff -rN -u old-irgramd/service.py new-irgramd/service.py
--- old-irgramd/service.py 2024-11-22 11:30:09.632497008 +0100
+++ new-irgramd/service.py 2024-11-22 11:30:09.636497002 +0100
@@ -106,7 +106,12 @@
if reply: return reply
else: reply = ()
- id = self.tg.mid.id_to_num_offset(peer_id, mid)
+ # If the ID starts with '=' is absolute ID, not compact ID
+ # character '=' is not used by compact IDs
+ if mid[0] == '=':
+ id = int(mid[1:])
+ else:
+ id = self.tg.mid.id_to_num_offset(peer_id, mid)
if id is not None:
msg = await self.tg.telegram_client.get_messages(entity=peer_id, ids=id)
if msg is not None:
@@ -120,8 +125,8 @@
if help == HELP.desc: # rest of HELP.desc
reply += \
(
- ' get <peer> <compact_id>',
- 'Get one message from peer with the compact ID',
+ ' get <peer> <compact_id|=ID>',
+ 'Get one message from peer with the compact or absolute ID',
)
return reply