Skip to content

Commit

Permalink
fix(userinteract): fix markdown parse fail problem when original text…
Browse files Browse the repository at this point in the history
… contains some reserved chars
  • Loading branch information
fython committed Jul 7, 2024
1 parent 071eff3 commit f3acbc1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/features/userinteract.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use crate::commands::ReplaceCommand;
use crate::msgfmt::markup_username_with_link;
use std::any::Any;
use std::ptr::replace;
use teloxide::prelude::*;
use teloxide::types::{MediaKind, MediaText, MessageKind, ParseMode};
use teloxide::utils::markdown::escape;

/// 处理用户对另一个用户的模拟指令行为
///
Expand Down Expand Up @@ -75,7 +74,7 @@ pub(crate) async fn handle_user_replace_words(
let from = msg.from().unwrap();
let replaced = text.replace(&cmd.keyword, &cmd.replacement);
let replacer = markup_username_with_link(from);
bot.send_message(msg.chat.id, format!("{} :{}", replacer, replaced))
bot.send_message(msg.chat.id, format!("{} :{}", replacer, escape(&replaced)))
.parse_mode(ParseMode::MarkdownV2)
.reply_to_message_id(msg.id)
.await?;
Expand Down

0 comments on commit f3acbc1

Please sign in to comment.