Handle more cases where the type is a date

This commit is contained in:
Lonami Exo 2017-05-19 09:30:30 +02:00
parent 0ef32a7d78
commit b84641023a

View File

@ -165,7 +165,9 @@ class TLArg:
# The name may contain "date" in it, if this is the case and the type is "int",
# we can safely assume that this should be treated as a "date" object.
# Note that this is not a valid Telegram object, but it's easier to work with
if re.search(r'(\b|_)date\b', name) and self.type == 'int':
if self.type == 'int' and (
re.search(r'(\b|_)date\b', name) or
name in ('expires', 'expires_at', 'was_online')):
self.type = 'date'
self.generic_definition = generic_definition