fix: ask only for chat_id instead of whole message in answer_message in

case of generalization
This commit is contained in:
Akulij 2025-04-10 02:34:41 +09:00
parent 089ef3218c
commit a58fca01f9

View File

@ -227,7 +227,7 @@ async fn user_command_handler(
let mut db2 = db.clone(); let mut db2 = db.clone();
answer_message( answer_message(
&bot, &bot,
&msg, msg.chat.id.0,
&mut db, &mut db,
"start", "start",
Some(make_start_buttons(&mut db2).await), Some(make_start_buttons(&mut db2).await),
@ -244,7 +244,7 @@ async fn user_command_handler(
async fn answer_message<RM: Into<ReplyMarkup>>( async fn answer_message<RM: Into<ReplyMarkup>>(
bot: &Bot, bot: &Bot,
msg: &Message, chat_id: i64,
db: &mut DB, db: &mut DB,
literal: &str, literal: &str,
keyboard: Option<RM>, keyboard: Option<RM>,
@ -254,7 +254,7 @@ async fn answer_message<RM: Into<ReplyMarkup>>(
.await .await
.unwrap() .unwrap()
.unwrap_or("Please, set content of this message".into()); .unwrap_or("Please, set content of this message".into());
let msg = bot.send_message(msg.chat.id, text); let msg = bot.send_message(ChatId(chat_id), text);
let msg = match keyboard { let msg = match keyboard {
Some(kbd) => msg.reply_markup(kbd), Some(kbd) => msg.reply_markup(kbd),
None => msg, None => msg,