It will probably be useful to add a timer. Here's the code:
for entity in channel_entities:
if entity.id == message.peer_id.channel_id:
if not message.out and message.id not in commented_messages[entity.id]:
try:
await asyncio.sleep(60) # Ожидание 60 секунд
await client.send_message(entity=entity, message=comment_text, comment_to=message)
gd_print("Созданный пост успешно прокомментирован.")
commented_messages[entity.id].add(message.id)
except Exception as e:
bd_print(f"Возникла ошибка при комментировании записи: {e}")