Skip to content

Commit

Permalink
feat: 互动调整
Browse files Browse the repository at this point in the history
  • Loading branch information
fython committed Mar 7, 2024
1 parent fd7f201 commit 0215211
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ async fn handle_messages_in_any_groups(bot: Bot, msg: Message) -> ResponseResult
match REPEATER_STATES.get_next_action(msg.chat.id, text.clone()) {
RepeaterNextAction::Repeat => {
log::info!("{} needs repeat", text.clone());
bot.send_message(msg.chat.id, text).await?;
bot.forward_message(msg.chat.id, msg.chat.id, msg.id)
.await?;
}
_ => (),
}
Expand Down
24 changes: 14 additions & 10 deletions src/userinteract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ pub(crate) async fn handle_user_do_sth_to_another(bot: &Bot, msg: &Message) -> O
if act.is_none() {
return None;
}
let act = act.unwrap();
let acts: Vec<&str> = act.unwrap().split_ascii_whitespace().into_iter().collect();
if acts.len() == 0 || acts[0] == "me" {
return None;
}
let mut text = format!(
"{} {}了 {}",
markup_username_with_link(from_user.unwrap()),
acts[0],
markup_username_with_link(reply_user.unwrap())
);
if acts.len() > 1 {
text.push_str(&format!(" {}", acts[1]));
}
let res = bot
.send_message(
msg.chat.id,
format!(
"{} {}了 {}",
markup_username_with_link(from_user.unwrap()),
act,
markup_username_with_link(reply_user.unwrap())
),
)
.send_message(msg.chat.id, text)
.parse_mode(ParseMode::MarkdownV2)
.await;
if res.is_err() {
Expand Down

0 comments on commit 0215211

Please sign in to comment.