From e97ac18060ea18c3ba357bd484c47f803d4100aa Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Fri, 3 Feb 2023 16:11:20 +0400 Subject: [PATCH] Add notes reminding to update places after updating updates --- crates/teloxide-core/src/types/update.rs | 6 ++++++ crates/teloxide/src/dispatching/handler_description.rs | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/crates/teloxide-core/src/types/update.rs b/crates/teloxide-core/src/types/update.rs index 6ec2040f..1516adb0 100644 --- a/crates/teloxide-core/src/types/update.rs +++ b/crates/teloxide-core/src/types/update.rs @@ -62,6 +62,12 @@ impl Update { #[derive(Clone, Debug, PartialEq)] pub enum UpdateKind { + // NB: When adding new variants, don't forget to update + // - `AllowedUpdate` + // - `Update::user` + // - `Update::chat` + // - `DpHandlerDescription::full_set` + // - `dispatching/filter_ext.rs` /// New incoming message of any kind — text, photo, sticker, etc. Message(Message), diff --git a/crates/teloxide/src/dispatching/handler_description.rs b/crates/teloxide/src/dispatching/handler_description.rs index a7aed7f7..4db15942 100644 --- a/crates/teloxide/src/dispatching/handler_description.rs +++ b/crates/teloxide/src/dispatching/handler_description.rs @@ -50,6 +50,16 @@ impl EventKind for Kind { fn full_set() -> HashSet { use AllowedUpdate::*; + // NB: We need to specify all update kinds by hand, because telegram doesn't + // enable `ChatMember` by default: + // + // > A JSON-serialized list of the update types you want your bot to + // > receive. For example, specify [“message”, “edited_channel_post”, + // > “callback_query”] to only receive updates of these types. See Update + // > for a complete list of available update types. Specify an empty list + // > to receive all update types except chat_member (default). If not + // > specified, the previous setting will be used. + [ Message, EditedMessage,