Skip to content

case-insensitive in conversationbot.py bot demo #4846

@fengxiaohu

Description

@fengxiaohu

Steps to Reproduce

  1. when i run sample conversationbot.py in the offical document, i found it is case-insensitive
Image

Expected behaviour

it should accept input such as boy/Boy/BOY

Actual behaviour

if I type wrong message, the program hang out

Operating System

macos

Version of Python, python-telegram-bot & dependencies

python-telegram-bot 21.5
Bot API 7.9
Python 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Relevant log output

Additional Context

I found just modify the code, it can fix this bug.
GENDER: [MessageHandler(filters.Regex("^(Boy|Girl|Other)$"), gender)],
to
GENDER: [MessageHandler(filters.Regex("(?i)^(Boy|Girl|Other)$"), gender)].

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions