create GoHome callback
This commit is contained in:
parent
7ec9c540e5
commit
5ec8e2201c
21
src/main.rs
21
src/main.rs
@ -84,6 +84,7 @@ pub enum State {
|
||||
pub enum Callback {
|
||||
MoreInfo,
|
||||
ProjectPage { id: u32 },
|
||||
GoHome,
|
||||
}
|
||||
|
||||
type CallbackStore = CallbackInfo<Callback>;
|
||||
@ -239,6 +240,26 @@ async fn callback_handler(bot: Bot, mut db: DB, q: CallbackQuery) -> BotResult<(
|
||||
bot.send_message(q.from.id, format!("Some project No: {id}"))
|
||||
.await?;
|
||||
}
|
||||
Callback::GoHome => {
|
||||
let keyboard = make_start_buttons(&mut db).await?;
|
||||
|
||||
replace_message(
|
||||
&bot,
|
||||
&mut db,
|
||||
q.chat_id().map(|i| i.0).unwrap_or(q.from.id.0 as i64),
|
||||
q.message.map_or_else(
|
||||
|| {
|
||||
Err(BotError::MsgTooOld(
|
||||
"Failed to get message id, probably message too old".to_string(),
|
||||
))
|
||||
},
|
||||
|m| Ok(m.id().0),
|
||||
)?,
|
||||
"start",
|
||||
Some(keyboard),
|
||||
)
|
||||
.await?
|
||||
}
|
||||
};
|
||||
|
||||
Ok(())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user