MCPcopy Index your code
hub / github.com/CodeXBotz/File-Sharing-Bot / get_message_id

Function get_message_id

helper_func.py:63–85  ·  view source on GitHub ↗
(client, message)

Source from the content-addressed store, hash-verified

61 return messages
62
63async def get_message_id(client, message):
64 if message.forward_from_chat:
65 if message.forward_from_chat.id == client.db_channel.id:
66 return message.forward_from_message_id
67 else:
68 return 0
69 elif message.forward_sender_name:
70 return 0
71 elif message.text:
72 pattern = "https://t.me/(?:c/)?(.*)/(\d+)"
73 matches = re.match(pattern,message.text)
74 if not matches:
75 return 0
76 channel_id = matches.group(1)
77 msg_id = int(matches.group(2))
78 if channel_id.isdigit():
79 if f"-100{channel_id}" == str(client.db_channel.id):
80 return msg_id
81 else:
82 if channel_id == client.db_channel.username:
83 return msg_id
84 else:
85 return 0
86
87
88def get_readable_time(seconds: int) -> str:

Callers 2

batchFunction · 0.90
link_generatorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected