What kind of feature are you missing? Where do you notice a shortcoming of PTB?
Have a dict representation of TelegramObject without having the attributes also converted to dicts
Describe the solution you'd like
Make TO.to_dict accept a parameter recursion that specifies up to which level attributes should be converted to dict. Logic:
recursion=None (default) recurs infinitely
0 gives a dict representation but doesn't convert attributes to dicts
1 converts attributes, but not attributes of attributes
- etc
Describe alternatives you've considered
Alternatively, a simple recursion=True/False could be a step in the same direction with, having the same effect as None/0 described above
Additional context
Would e.g. allow to do ptbcontrib.send_by_kwargs(bot, chat_id=chat_id, **message.to_dict(recursion=0). See also python-telegram-bot/ptbcontrib#39 which was implemented only partly
Just a wild idea so far and of no major importance to me :)
What kind of feature are you missing? Where do you notice a shortcoming of PTB?
Have a dict representation of
TelegramObjectwithout having the attributes also converted to dictsDescribe the solution you'd like
Make
TO.to_dictaccept a parameterrecursionthat specifies up to which level attributes should be converted to dict. Logic:recursion=None(default) recurs infinitely0gives a dict representation but doesn't convert attributes to dicts1converts attributes, but not attributes of attributesDescribe alternatives you've considered
Alternatively, a simple
recursion=True/Falsecould be a step in the same direction with, having the same effect asNone/0described aboveAdditional context
Would e.g. allow to do
ptbcontrib.send_by_kwargs(bot, chat_id=chat_id, **message.to_dict(recursion=0). See also python-telegram-bot/ptbcontrib#39 which was implemented only partlyJust a wild idea so far and of no major importance to me :)