mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 17:33:44 +00:00
Update prepare_arg for new types.
This commit is contained in:
parent
e826e3daa4
commit
8676c17c77
1 changed files with 3 additions and 3 deletions
|
|
@ -16,11 +16,11 @@ def generate_payload(exclude=None, **kwargs):
|
||||||
|
|
||||||
def prepare_arg(value):
|
def prepare_arg(value):
|
||||||
if value is None:
|
if value is None:
|
||||||
return None
|
return value
|
||||||
elif isinstance(value, (list, dict)):
|
elif isinstance(value, (list, dict)):
|
||||||
return json.dumps(value)
|
return json.dumps(value)
|
||||||
elif hasattr(value, 'to_json'):
|
elif hasattr(value, 'to_python'):
|
||||||
return json.dumps(value.to_json())
|
return json.dumps(value.to_python())
|
||||||
elif isinstance(value, datetime.timedelta):
|
elif isinstance(value, datetime.timedelta):
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
return int((now + value).timestamp())
|
return int((now + value).timestamp())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue