diff --git a/changes/unreleased/4855.8hCFRFMeMaRWpBEYaxrTMq.toml b/changes/unreleased/4855.8hCFRFMeMaRWpBEYaxrTMq.toml new file mode 100644 index 00000000000..cbbda59a270 --- /dev/null +++ b/changes/unreleased/4855.8hCFRFMeMaRWpBEYaxrTMq.toml @@ -0,0 +1,5 @@ +other= "Make Gender Input Case-Insensitive in ``conversationbot.py``" +[[pull_requests]] +uid = "4855" +author_uid = "fengxiaohu" +closes_threads = ["4846"] diff --git a/examples/conversationbot.py b/examples/conversationbot.py index 751f48f74e0..dbe637c1203 100644 --- a/examples/conversationbot.py +++ b/examples/conversationbot.py @@ -145,7 +145,9 @@ def main() -> None: conv_handler = ConversationHandler( entry_points=[CommandHandler("start", start)], states={ - GENDER: [MessageHandler(filters.Regex("^(Boy|Girl|Other)$"), gender)], + # Use case-insensitive regex to accept gender input regardless of letter casing, + # e.g., "boy", "BOY", "Girl", etc., will all be matched + GENDER: [MessageHandler(filters.Regex("(?i)^(Boy|Girl|Other)$"), gender)], PHOTO: [MessageHandler(filters.PHOTO, photo), CommandHandler("skip", skip_photo)], LOCATION: [ MessageHandler(filters.LOCATION, location),