if (message.content.startswith('123')): async with aiohttp.ClientSession() as session: async with session.get(f'site goes here') as r: channel = client.get_channel(1287186067405017109) #-dead-bosses if r.status == 200: text = await r.text() tr = html.fromstring(text) # buyers = tr.xpath("tbody/tr/td/a/text()") tables = tr.xpath("//table") table = tr.xpath("//table")[0] answer = "Random Text" if len( tables) >= 2 else "Random Text 2\n" for row in table.xpath(".//tbody//tr"): cells = [cell.text_content() for cell in row.xpath(".//td")] answer += f"- {cells[0]}: - {cells[1]}\n" if len(tables) > 1: table2 = tr.xpath("//table")[1] answer += "Random Text2" for row in table2.xpath(".//tbody//tr"): cells = [cell.text_content() for cell in row.xpath(".//td")] answer += f"- {cells[0]}: - {cells[1]}\n" await channel.send(answer) else: await channel.send("failed") My bot sends whole data from this site - Table one (recently killed bosses) and table two (bosses to check). After some time table one disappears. What I want is to edit this code so it would send only first table when there are 2 tables on the site, and when there's only 1 on the site it's going to send message "too late". Can someone help me? Continue reading...