Skip to content

Commit

Permalink
Example formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-nikolaev committed May 19, 2024
1 parent 0519735 commit 615d654
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os

from aiogram import Bot

from sulguk import transform_html

CHAT_ID = 1
Expand All @@ -10,25 +11,32 @@
async def main():
with open("example.html") as f:
raw_html = f.read()

result = transform_html(raw_html)

print("Text:")
print(result.text)
for entity in result.entities:
print(repr(entity))
print()

bot = Bot(token=os.getenv("BOT_TOKEN"))

await bot.send_message(
chat_id=CHAT_ID,
text=raw_html,
disable_web_page_preview=True,
)

await bot.send_message(
chat_id=CHAT_ID,
text=result.text,
entities=result.entities,
disable_web_page_preview=True,
)

await bot.session.close()


asyncio.run(main())
if __name__ == "__main__":
asyncio.run(main())

0 comments on commit 615d654

Please sign in to comment.