Make parse_mode always lowercase (#575)

* Make parse_mode always lowercase

* Update client.py

Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
Alisson Lauffer 2021-05-12 03:49:48 -03:00 committed by GitHub
parent b4bdab1047
commit df4419da8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -397,6 +397,9 @@ class Client(Methods, Scaffold):
@parse_mode.setter
def parse_mode(self, parse_mode: Optional[str] = "combined"):
if isinstance(parse_mode, str):
parse_mode = parse_mode.lower()
if parse_mode not in self.PARSE_MODES:
raise ValueError('parse_mode must be one of {} or None. Not "{}"'.format(
", ".join(f'"{m}"' for m in self.PARSE_MODES[:-1]),