teloxide/dispatching/dialogue/
key.rs1use serde::{Deserialize, Serialize};
2use teloxide_core::types::{BusinessConnectionId, ChatId};
3
4#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
7pub struct DialogueKey {
8 pub chat_id: ChatId,
9 pub business_connection_id: Option<BusinessConnectionId>,
10}
11
12impl From<ChatId> for DialogueKey {
13 fn from(chat_id: ChatId) -> Self {
14 Self { chat_id, business_connection_id: None }
15 }
16}
17
18impl DialogueKey {
19 #[must_use]
21 pub fn business(chat_id: ChatId, business_connection_id: BusinessConnectionId) -> Self {
22 Self { chat_id, business_connection_id: Some(business_connection_id) }
23 }
24}