Correct typo

This commit is contained in:
Yi Zhao 2024-03-29 23:24:44 +08:00
parent 35d6368779
commit 790bd55517
2 changed files with 3 additions and 2 deletions

View File

@ -23,7 +23,7 @@ BOT_MESSAGE_LENGTH = 4000
def bot_reply_first(message: Message, who: str, bot: TeleBot) -> Message: def bot_reply_first(message: Message, who: str, bot: TeleBot) -> Message:
""" Create the first reply message which make user feel the bot is working. """ """ Create the first reply message which make user feel the bot is working. """
return bot.reply_to(message, return bot.reply_to(message,
f"**{who}** is __thinking__ \.\.\.", f"**{who}** is *thinking* \.\.\.",
parse_mode="MarkdownV2" parse_mode="MarkdownV2"
) )
@ -53,7 +53,7 @@ def bot_reply_markdown(reply_id: Message, who: str, text: str, bot: TeleBot) ->
for i in range(1, len(msgs)): for i in range(1, len(msgs)):
bot.reply_to( bot.reply_to(
reply_id.reply_to_message, reply_id.reply_to_message,
f"**{hint}** \[{i+1}/{len(msgs)}\]:\n{telegramify_markdown.convert(msgs[i])}", f"**{who}** \[{i+1}/{len(msgs)}\]:\n{telegramify_markdown.convert(msgs[i])}",
parse_mode="MarkdownV2", parse_mode="MarkdownV2",
) )
except Exception as e: except Exception as e:

View File

@ -69,6 +69,7 @@ def gemini_handler(message: Message, bot: TeleBot) -> None:
gemini_reply_text = player.last.text.strip() gemini_reply_text = player.last.text.strip()
# Gemini is often using ':' in **Title** which not work in Telegram Markdown # Gemini is often using ':' in **Title** which not work in Telegram Markdown
gemini_reply_text = gemini_reply_text.replace(":**", "\:**") gemini_reply_text = gemini_reply_text.replace(":**", "\:**")
gemini_reply_text = gemini_reply_text.replace(": **", "\:** ")
except StopCandidateException as e: except StopCandidateException as e:
match = re.search(r'content\s*{\s*parts\s*{\s*text:\s*"([^"]+)"', str(e)) match = re.search(r'content\s*{\s*parts\s*{\s*text:\s*"([^"]+)"', str(e))
if match: if match: