diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.rs | 4 | ||||
-rw-r--r-- | src/keyboard.rs | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/commands.rs b/src/commands.rs index 512e3c1..b03e1c6 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -3,7 +3,7 @@ use crate::config::Config; use crate::keyboard::make_inline_keyboard; use std::error::Error; use teloxide::payloads::SendMessageSetters; -use teloxide::prelude::{AutoSend, Bot, Message, UpdateWithCx}; +use teloxide::prelude::{AutoSend, Bot, GetChatId, Message, UpdateWithCx}; use teloxide::utils::command::BotCommand; #[derive(BotCommand)] @@ -54,7 +54,7 @@ pub async fn handler( faculties = browser::get_faculties().await.unwrap(); } - let keyboard = make_inline_keyboard(&faculties, "faculty").await; + let keyboard = make_inline_keyboard(&faculties, "faculty", cx.chat_id()).await; cx.answer("Where?").reply_markup(keyboard).await?; } } diff --git a/src/keyboard.rs b/src/keyboard.rs index ea57d66..8cee93d 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -5,6 +5,7 @@ use teloxide::types::{InlineKeyboardButton, InlineKeyboardMarkup}; pub async fn make_inline_keyboard( hashmap: &Option<HashMap<String, String>>, callback_type: &str, + chat_id: i64, ) -> InlineKeyboardMarkup { // This is an array of array because the `InlineKeyboardMarkup` // considers each array as a row. @@ -16,7 +17,7 @@ pub async fn make_inline_keyboard( for (key, value) in options { keyboard_array.push(vec![InlineKeyboardButton::callback( value.clone(), - format!("{}_{}", callback_type, key), + format!("{}_{}_{}", chat_id, callback_type, key), )]); } } else { |