Rewrite Bot classes. Add moooooore pydocs.

This commit is contained in:
Alex Root Junior 2017-07-24 21:46:43 +03:00
parent a6e90655bc
commit ffbb89100c
5 changed files with 2030 additions and 967 deletions

View file

@ -1,3 +1,5 @@
from aiogram.utils import json
DEFAULT_FILTER = ['self']
@ -8,3 +10,11 @@ def generate_payload(exclude=None, **kwargs):
key not in exclude + DEFAULT_FILTER
and value
and not key.startswith('_')}
def prepare_arg(value):
if isinstance(value, (list, dict)):
return json.dumps(value)
elif hasattr(value, 'to_json'):
return json.dumps(value.to_json())
return value