mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-10 17:53:17 +00:00
Set default values for not specified fields in payload. // TelegramObject
This commit is contained in:
parent
21f35273b7
commit
787ebe3e63
1 changed files with 8 additions and 1 deletions
|
|
@ -75,12 +75,19 @@ class TelegramObject(metaclass=MetaTelegramObject):
|
|||
"""
|
||||
if conf is None:
|
||||
conf = {}
|
||||
self._conf = conf
|
||||
|
||||
# Load data
|
||||
for key, value in kwargs.items():
|
||||
if key in self.props:
|
||||
self.props[key].set_value(self, value, parent=self)
|
||||
else:
|
||||
self.values[key] = value
|
||||
self._conf = conf
|
||||
|
||||
# Load default values
|
||||
for key, value in self.props.items():
|
||||
if value.default and key not in self.values:
|
||||
self.values[key] = value.default
|
||||
|
||||
@property
|
||||
def conf(self) -> typing.Dict[str, typing.Any]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue