From 325c0b8207a3be2eca37acd70fe14399594f3905 Mon Sep 17 00:00:00 2001 From: Sense T Date: Thu, 18 Jan 2024 16:18:19 +0800 Subject: [PATCH] no @ started name supported --- src/inline_query.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/inline_query.rs b/src/inline_query.rs index 543c228..75561d7 100644 --- a/src/inline_query.rs +++ b/src/inline_query.rs @@ -39,20 +39,28 @@ pub async fn inline_menu(db: &Controller, bot: &Bot, q: InlineQuery) -> Result<( results.push(InlineQueryResult::Article(InlineQueryResultArticle::new( name.clone(), - format!("{} {}", BOT_TEXT_INLINE_HANG, name), + format!("{} {}", BOT_TEXT_INLINE_HANG, name.clone()), InputMessageContent::Text(InputMessageContentText::new(hangit_text( - name, + name.clone(), !IS_SELF, !NEED_ESCAPE, ))), ))); + if name.starts_with("@") { + results = vec![] + } + bot.answer_inline_query(&q.id, results).send().await?; Ok(()) } pub async fn inline_anwser(db: &Controller, a: ChosenInlineResult) -> Result<(), RequestError> { log_debug_ln!("{:#?}", a); + + if a.result_id == "@" { + return Ok(()); + } if let Err(err) = db.hangit(&a.result_id, ChatId(0)).await { log_error_ln!("{:?}", err);