@@ -15116,23 +15116,29 @@ def to_dict(self):
1511615116
1511715117class RichBlockListItem(RichBlock):
1511815118 """List item block. Telegram documentation: https://core.telegram.org/bots/api#richblocklistitem"""
15119- def __init__(self, label: Optional[RichText] = None, page_blocks: Optional[List['RichBlock']] = None, **kwargs):
15119+ def __init__(self, label: Optional[str] = None, blocks: Optional[List['RichBlock']] = None,
15120+ has_checkbox: Optional[bool] = None, is_checked: Optional[bool] = None,
15121+ value: Optional[int] = None, **kwargs):
1512015122 super().__init__('list_item')
15121- self.label: Optional[RichText] = label
15122- self.page_blocks: Optional[List[RichBlock]] = page_blocks
15123+ self.label: Optional[str] = label
15124+ self.blocks: Optional[List[RichBlock]] = blocks
15125+ self.has_checkbox: Optional[bool] = has_checkbox
15126+ self.is_checked: Optional[bool] = is_checked
15127+ self.value: Optional[int] = value
1512315128
1512415129 @classmethod
1512515130 def _from_dict(cls, obj: dict):
15126- if 'label' in obj and isinstance(obj['label'], dict):
15127- obj['label'] = RichText.de_json(obj['label'])
15128- if 'page_blocks' in obj:
15129- obj['page_blocks'] = [RichBlock.de_json(b) for b in obj['page_blocks']]
15131+ if 'blocks' in obj:
15132+ obj['blocks'] = [RichBlock.de_json(b) for b in obj['blocks']]
1513015133 return cls(**obj)
1513115134
1513215135 def to_dict(self):
1513315136 d = super().to_dict()
15134- if self.label: d['label'] = self.label.to_dict()
15135- if self.page_blocks: d['page_blocks'] = [b.to_dict() for b in self.page_blocks]
15137+ if self.label is not None: d['label'] = self.label
15138+ if self.blocks: d['blocks'] = [b.to_dict() for b in self.blocks]
15139+ if self.has_checkbox is not None: d['has_checkbox'] = self.has_checkbox
15140+ if self.is_checked is not None: d['is_checked'] = self.is_checked
15141+ if self.value is not None: d['value'] = self.value
1513615142 return d
1513715143
1513815144
@@ -15156,10 +15162,10 @@ def to_dict(self):
1515615162
1515715163class RichBlockSectionHeading(RichBlock):
1515815164 """Section heading block. Telegram documentation: https://core.telegram.org/bots/api#richblocksectionheading"""
15159- def __init__(self, text: Optional[RichText] = None, level : int = 1, **kwargs):
15160- super().__init__('section_heading ')
15165+ def __init__(self, text: Optional[RichText] = None, size : int = 1, **kwargs):
15166+ super().__init__('heading ')
1516115167 self.text: Optional[RichText] = text
15162- self.level : int = level
15168+ self.size : int = size
1516315169
1516415170 @classmethod
1516515171 def _from_dict(cls, obj: dict):
@@ -15170,14 +15176,14 @@ def _from_dict(cls, obj: dict):
1517015176 def to_dict(self):
1517115177 d = super().to_dict()
1517215178 if self.text: d['text'] = self.text.to_dict()
15173- d['level '] = self.level
15179+ d['size '] = self.size
1517415180 return d
1517515181
1517615182
1517715183class RichBlockPreformatted(RichBlock):
1517815184 """Preformatted text block. Telegram documentation: https://core.telegram.org/bots/api#richblockpreformatted"""
1517915185 def __init__(self, text: Optional[RichText] = None, language: Optional[str] = None, **kwargs):
15180- super().__init__('preformatted ')
15186+ super().__init__('pre ')
1518115187 self.text: Optional[RichText] = text
1518215188 self.language: Optional[str] = language
1518315189
@@ -15256,10 +15262,9 @@ def to_dict(self):
1525615262
1525715263class RichBlockList(RichBlock):
1525815264 """List block. Telegram documentation: https://core.telegram.org/bots/api#richblocklist"""
15259- def __init__(self, items: Optional[List[RichBlockListItem]] = None, is_ordered: bool = False, **kwargs):
15265+ def __init__(self, items: Optional[List[RichBlockListItem]] = None, **kwargs):
1526015266 super().__init__('list')
1526115267 self.items: Optional[List[RichBlockListItem]] = items
15262- self.is_ordered: bool = is_ordered
1526315268
1526415269 @classmethod
1526515270 def _from_dict(cls, obj: dict):
@@ -15270,36 +15275,35 @@ def _from_dict(cls, obj: dict):
1527015275 def to_dict(self):
1527115276 d = super().to_dict()
1527215277 if self.items: d['items'] = [i.to_dict() for i in self.items]
15273- d['is_ordered'] = self.is_ordered
1527415278 return d
1527515279
1527615280
1527715281class RichBlockBlockQuotation(RichBlock):
1527815282 """Block quotation block. Telegram documentation: https://core.telegram.org/bots/api#richblockblockquotation"""
15279- def __init__(self, text : Optional[RichText] = None, caption : Optional[RichText] = None, **kwargs):
15280- super().__init__('block_quotation ')
15281- self.text : Optional[RichText] = text
15282- self.caption : Optional[RichText] = caption
15283+ def __init__(self, blocks : Optional[List['RichBlock']] = None, credit : Optional[RichText] = None, **kwargs):
15284+ super().__init__('blockquote ')
15285+ self.blocks : Optional[List[RichBlock]] = blocks
15286+ self.credit : Optional[RichText] = credit
1528315287
1528415288 @classmethod
1528515289 def _from_dict(cls, obj: dict):
15286- if 'text ' in obj and isinstance(obj['text'], dict) :
15287- obj['text '] = RichText .de_json(obj['text'])
15288- if 'caption ' in obj and isinstance(obj['caption '], dict):
15289- obj['caption '] = RichText.de_json(obj['caption '])
15290+ if 'blocks ' in obj:
15291+ obj['blocks '] = [RichBlock .de_json(b) for b in obj['blocks']]
15292+ if 'credit ' in obj and isinstance(obj['credit '], dict):
15293+ obj['credit '] = RichText.de_json(obj['credit '])
1529015294 return cls(**obj)
1529115295
1529215296 def to_dict(self):
1529315297 d = super().to_dict()
15294- if self.text : d['text '] = self.text. to_dict()
15295- if self.caption : d['caption '] = self.caption .to_dict()
15298+ if self.blocks : d['blocks '] = [b. to_dict() for b in self.blocks]
15299+ if self.credit : d['credit '] = self.credit .to_dict()
1529615300 return d
1529715301
1529815302
1529915303class RichBlockPullQuotation(RichBlock):
1530015304 """Pull quotation block. Telegram documentation: https://core.telegram.org/bots/api#richblockpullquotation"""
1530115305 def __init__(self, text: Optional[RichText] = None, credit: Optional[RichText] = None, **kwargs):
15302- super().__init__('pull_quotation ')
15306+ super().__init__('pullquote ')
1530315307 self.text: Optional[RichText] = text
1530415308 self.credit: Optional[RichText] = credit
1530515309
@@ -15320,46 +15324,46 @@ def to_dict(self):
1532015324
1532115325class RichBlockCollage(RichBlock):
1532215326 """Collage of media block. Telegram documentation: https://core.telegram.org/bots/api#richblockcollage"""
15323- def __init__(self, page_blocks : Optional[List['RichBlock']] = None,
15327+ def __init__(self, blocks : Optional[List['RichBlock']] = None,
1532415328 caption: Optional[RichBlockCaption] = None, **kwargs):
1532515329 super().__init__('collage')
15326- self.page_blocks : Optional[List[RichBlock]] = page_blocks
15330+ self.blocks : Optional[List[RichBlock]] = blocks
1532715331 self.caption: Optional[RichBlockCaption] = caption
1532815332
1532915333 @classmethod
1533015334 def _from_dict(cls, obj: dict):
15331- if 'page_blocks ' in obj:
15332- obj['page_blocks '] = [RichBlock.de_json(b) for b in obj['page_blocks ']]
15335+ if 'blocks ' in obj:
15336+ obj['blocks '] = [RichBlock.de_json(b) for b in obj['blocks ']]
1533315337 if 'caption' in obj and isinstance(obj['caption'], dict):
1533415338 obj['caption'] = RichBlock.de_json(obj['caption'])
1533515339 return cls(**obj)
1533615340
1533715341 def to_dict(self):
1533815342 d = super().to_dict()
15339- if self.page_blocks : d['page_blocks '] = [b.to_dict() for b in self.page_blocks ]
15343+ if self.blocks : d['blocks '] = [b.to_dict() for b in self.blocks ]
1534015344 if self.caption: d['caption'] = self.caption.to_dict()
1534115345 return d
1534215346
1534315347
1534415348class RichBlockSlideshow(RichBlock):
1534515349 """Slideshow block. Telegram documentation: https://core.telegram.org/bots/api#richblockslideshow"""
15346- def __init__(self, page_blocks : Optional[List['RichBlock']] = None,
15350+ def __init__(self, blocks : Optional[List['RichBlock']] = None,
1534715351 caption: Optional[RichBlockCaption] = None, **kwargs):
1534815352 super().__init__('slideshow')
15349- self.page_blocks : Optional[List[RichBlock]] = page_blocks
15353+ self.blocks : Optional[List[RichBlock]] = blocks
1535015354 self.caption: Optional[RichBlockCaption] = caption
1535115355
1535215356 @classmethod
1535315357 def _from_dict(cls, obj: dict):
15354- if 'page_blocks ' in obj:
15355- obj['page_blocks '] = [RichBlock.de_json(b) for b in obj['page_blocks ']]
15358+ if 'blocks ' in obj:
15359+ obj['blocks '] = [RichBlock.de_json(b) for b in obj['blocks ']]
1535615360 if 'caption' in obj and isinstance(obj['caption'], dict):
1535715361 obj['caption'] = RichBlock.de_json(obj['caption'])
1535815362 return cls(**obj)
1535915363
1536015364 def to_dict(self):
1536115365 d = super().to_dict()
15362- if self.page_blocks : d['page_blocks '] = [b.to_dict() for b in self.page_blocks ]
15366+ if self.blocks : d['blocks '] = [b.to_dict() for b in self.blocks ]
1536315367 if self.caption: d['caption'] = self.caption.to_dict()
1536415368 return d
1536515369
@@ -15395,27 +15399,27 @@ def to_dict(self):
1539515399
1539615400class RichBlockDetails(RichBlock):
1539715401 """Expandable details block. Telegram documentation: https://core.telegram.org/bots/api#richblockdetails"""
15398- def __init__(self, header : Optional[RichText] = None,
15399- page_blocks : Optional[List['RichBlock']] = None,
15400- is_open: bool = False , **kwargs):
15402+ def __init__(self, summary : Optional[RichText] = None,
15403+ blocks : Optional[List['RichBlock']] = None,
15404+ is_open: Optional[ bool] = None , **kwargs):
1540115405 super().__init__('details')
15402- self.header : Optional[RichText] = header
15403- self.page_blocks : Optional[List[RichBlock]] = page_blocks
15404- self.is_open: bool = is_open
15406+ self.summary : Optional[RichText] = summary
15407+ self.blocks : Optional[List[RichBlock]] = blocks
15408+ self.is_open: Optional[ bool] = is_open
1540515409
1540615410 @classmethod
1540715411 def _from_dict(cls, obj: dict):
15408- if 'header ' in obj and isinstance(obj['header '], dict):
15409- obj['header '] = RichText.de_json(obj['header '])
15410- if 'page_blocks ' in obj:
15411- obj['page_blocks '] = [RichBlock.de_json(b) for b in obj['page_blocks ']]
15412+ if 'summary ' in obj and isinstance(obj['summary '], dict):
15413+ obj['summary '] = RichText.de_json(obj['summary '])
15414+ if 'blocks ' in obj:
15415+ obj['blocks '] = [RichBlock.de_json(b) for b in obj['blocks ']]
1541215416 return cls(**obj)
1541315417
1541415418 def to_dict(self):
1541515419 d = super().to_dict()
15416- if self.header : d['header '] = self.header .to_dict()
15417- if self.page_blocks : d['page_blocks '] = [b.to_dict() for b in self.page_blocks ]
15418- d['is_open'] = self.is_open
15420+ if self.summary : d['summary '] = self.summary .to_dict()
15421+ if self.blocks : d['blocks '] = [b.to_dict() for b in self.blocks ]
15422+ if self.is_open is not None: d['is_open'] = self.is_open
1541915423 return d
1542015424
1542115425
@@ -15599,15 +15603,15 @@ def to_dict(self):
1559915603 'table_cell': RichBlockTableCell,
1560015604 'list_item': RichBlockListItem,
1560115605 'paragraph': RichBlockParagraph,
15602- 'section_heading ': RichBlockSectionHeading,
15603- 'preformatted ': RichBlockPreformatted,
15606+ 'heading ': RichBlockSectionHeading,
15607+ 'pre ': RichBlockPreformatted,
1560415608 'footer': RichBlockFooter,
1560515609 'divider': RichBlockDivider,
1560615610 'mathematical_expression': RichBlockMathematicalExpression,
1560715611 'anchor': RichBlockAnchor,
1560815612 'list': RichBlockList,
15609- 'block_quotation ': RichBlockBlockQuotation,
15610- 'pull_quotation ': RichBlockPullQuotation,
15613+ 'blockquote ': RichBlockBlockQuotation,
15614+ 'pullquote ': RichBlockPullQuotation,
1561115615 'collage': RichBlockCollage,
1561215616 'slideshow': RichBlockSlideshow,
1561315617 'table': RichBlockTable,
0 commit comments