diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f458549..69728953 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `filter_video_chat_ended` - `filter_video_chat_participants_invited` - `filter_web_app_data` +- Implement `GetChatId` for `teloxide_core::types::{Chat, ChatJoinRequest, ChatMemberUpdated}`. ### Fixed diff --git a/crates/teloxide/src/dispatching/dialogue/get_chat_id.rs b/crates/teloxide/src/dispatching/dialogue/get_chat_id.rs index a0e72f8b..632f4bbe 100644 --- a/crates/teloxide/src/dispatching/dialogue/get_chat_id.rs +++ b/crates/teloxide/src/dispatching/dialogue/get_chat_id.rs @@ -1,6 +1,8 @@ -use crate::types::{CallbackQuery, ChatId, Message, Update}; +use crate::types::{ + CallbackQuery, Chat, ChatId, ChatJoinRequest, ChatMemberUpdated, Message, Update, +}; -/// Something that may has a chat ID. +/// Something that may have a chat ID. pub trait GetChatId { #[must_use] fn chat_id(&self) -> Option; @@ -23,3 +25,21 @@ impl GetChatId for Update { self.chat().map(|chat| chat.id) } } + +impl GetChatId for Chat { + fn chat_id(&self) -> Option { + Some(self.id) + } +} + +impl GetChatId for ChatMemberUpdated { + fn chat_id(&self) -> Option { + Some(self.chat.id) + } +} + +impl GetChatId for ChatJoinRequest { + fn chat_id(&self) -> Option { + Some(self.chat.id) + } +}