I need to have script to read last message of telegram channel. If last message of this channel is reply to something I want to read that message what has last message answered to. For example highlighted message on this picture.
https://i.stack.imgur.com/cRSzS.jpg
I have this code to read last message but I have no idea how to read that message, I know I can use parameter is_reply to know if last message is reply to something but I don’t know what to do next, any ideas?
async def get_mess():
limit = 1
global new
async for message in client.iter_messages('Passive Lifestyle Forex Signals', limit):
new = message.text
whlie True:
get_mess()
I know it isn’t most effective but that’s not important. Any ideas how to code this? I can answer you if you need something more specific.
2
Answers
I would suggest to use
get_messages
to get the last message so you can also omit the limit. Then you’ll need to check if the message is replying to an another message and if yes, get it.