Hey Hamza, you chould try to take the difference between every 2 consecutive msg and see if it is more than a certain threshold. You'll probably need to use Python's time module here.
Sorry for the late response. I would request you to join the above mentioned Slack group to get faster help from me or your peers as well! :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.