-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔧 feat: add mermaid diagram rendering and improve logger integration
- Implement mermaid diagram support in markdown processing. - Introduce new logger for better message handling. - Update type hints for better code clarity. - Adjusted project dependencies in pyproject.toml.
- Loading branch information
Showing
9 changed files
with
740 additions
and
181 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
import pathlib | ||
from time import sleep | ||
|
||
from dotenv import load_dotenv | ||
from telebot import TeleBot | ||
|
||
import telegramify_markdown | ||
from telegramify_markdown import ContentTypes | ||
from telegramify_markdown.customize import markdown_symbol | ||
|
||
tips = """ | ||
telegramify_markdown.telegramify | ||
The stability of telegramify_markdown.telegramify is unproven, please keep good log records. | ||
Feel free to check it out, if you have any questions please open an issue | ||
""" | ||
|
||
load_dotenv() | ||
telegram_bot_token = os.getenv("TELEGRAM_BOT_TOKEN", None) | ||
chat_id = os.getenv("TELEGRAM_CHAT_ID", None) | ||
bot = TeleBot(telegram_bot_token) | ||
|
||
markdown_symbol.head_level_1 = "📌" # If you want, Customizing the head level 1 symbol | ||
markdown_symbol.link = "🔗" # If you want, Customizing the link symbol | ||
md = pathlib.Path(__file__).parent.joinpath("t_longtext.md").read_text(encoding="utf-8") | ||
boxs = telegramify_markdown.telegramify(md) | ||
for item in boxs: | ||
print("Sent one item") | ||
sleep(0.2) | ||
if item.content_type == ContentTypes.TEXT: | ||
print("TEXT") | ||
print(item.content) | ||
elif item.content_type == ContentTypes.PHOTO: | ||
print("PHOTO") | ||
print(item.caption) | ||
elif item.content_type == ContentTypes.FILE: | ||
print("FILE") | ||
print(item.file_name) |
Oops, something went wrong.