Relative Content

Tag Archive for pythontelethontelegram-api

how to parse the text of a message and buttons from a message that has been edited it telegram

async def exped(self): while self.config.get(“expedition”, False): if self.nextexp is None or datetime.now() >= datetime.strptime(self.nextexp, “%Y-%m-%d %H:%M:%S”): await self.client.send_message(“@game_bot”, “Expeditions”) await asyncio.sleep(3) msg = await self.client.get_messages(“@game_bot”) if “Current Expedition” in msg[0].message: wait_time_match = re.search(r”After : s+(d+)h.s+(d+)min.s+(d+)sec”, msg[0].message) if wait_time_match: hours, minutes, seconds = map(int, wait_time_match.groups()) next_exp_time = datetime.now() + timedelta(hours=hours, minutes=minutes, seconds=seconds) self.set(“nextexp”, next_exp_time.strftime(“%Y-%m-%d %H:%M:%S”)) self.nextexp […]