ng-bot-api 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ng_bot_api/__init__.py +56 -0
- ng_bot_api/api_version.py +2 -0
- ng_bot_api/async_bot.py +97 -0
- ng_bot_api/core/__init__.py +31 -0
- ng_bot_api/core/base.py +36 -0
- ng_bot_api/core/caller.py +17 -0
- ng_bot_api/core/decoding.py +85 -0
- ng_bot_api/core/encoding.py +42 -0
- ng_bot_api/core/errors.py +75 -0
- ng_bot_api/core/input_file.py +56 -0
- ng_bot_api/core/polling.py +39 -0
- ng_bot_api/core/registry.py +72 -0
- ng_bot_api/core/request.py +67 -0
- ng_bot_api/core/typespec.py +57 -0
- ng_bot_api/dispatcher/__init__.py +17 -0
- ng_bot_api/dispatcher/dispatcher.py +95 -0
- ng_bot_api/dispatcher/filter_base.py +78 -0
- ng_bot_api/dispatcher/filters.py +124 -0
- ng_bot_api/dispatcher/handler.py +34 -0
- ng_bot_api/dispatcher/router.py +69 -0
- ng_bot_api/methods/__init__.py +115 -0
- ng_bot_api/methods/async_01.py +99 -0
- ng_bot_api/methods/async_02.py +114 -0
- ng_bot_api/methods/async_03.py +85 -0
- ng_bot_api/methods/async_04.py +110 -0
- ng_bot_api/methods/async_05.py +114 -0
- ng_bot_api/methods/async_06.py +74 -0
- ng_bot_api/methods/async_07.py +114 -0
- ng_bot_api/methods/async_08.py +106 -0
- ng_bot_api/methods/async_09.py +97 -0
- ng_bot_api/methods/async_10.py +92 -0
- ng_bot_api/methods/async_11.py +107 -0
- ng_bot_api/methods/async_12.py +119 -0
- ng_bot_api/methods/async_13.py +119 -0
- ng_bot_api/methods/async_14.py +113 -0
- ng_bot_api/methods/async_15.py +117 -0
- ng_bot_api/methods/async_16.py +115 -0
- ng_bot_api/methods/async_17.py +121 -0
- ng_bot_api/methods/async_18.py +118 -0
- ng_bot_api/methods/async_19.py +128 -0
- ng_bot_api/methods/async_20.py +115 -0
- ng_bot_api/methods/async_21.py +127 -0
- ng_bot_api/methods/async_22.py +110 -0
- ng_bot_api/methods/async_23.py +116 -0
- ng_bot_api/methods/async_24.py +118 -0
- ng_bot_api/methods/async_25.py +109 -0
- ng_bot_api/methods/async_26.py +124 -0
- ng_bot_api/methods/async_27.py +119 -0
- ng_bot_api/methods/async_28.py +119 -0
- ng_bot_api/methods/async_29.py +108 -0
- ng_bot_api/methods/async_30.py +115 -0
- ng_bot_api/methods/async_31.py +112 -0
- ng_bot_api/methods/async_32.py +126 -0
- ng_bot_api/methods/async_33.py +105 -0
- ng_bot_api/methods/async_34.py +117 -0
- ng_bot_api/methods/async_35.py +122 -0
- ng_bot_api/methods/async_36.py +121 -0
- ng_bot_api/methods/async_37.py +126 -0
- ng_bot_api/methods/async_38.py +112 -0
- ng_bot_api/methods/async_39.py +84 -0
- ng_bot_api/methods/async_40.py +125 -0
- ng_bot_api/methods/async_41.py +115 -0
- ng_bot_api/methods/async_42.py +30 -0
- ng_bot_api/methods/sync_01.py +99 -0
- ng_bot_api/methods/sync_02.py +114 -0
- ng_bot_api/methods/sync_03.py +85 -0
- ng_bot_api/methods/sync_04.py +110 -0
- ng_bot_api/methods/sync_05.py +114 -0
- ng_bot_api/methods/sync_06.py +74 -0
- ng_bot_api/methods/sync_07.py +114 -0
- ng_bot_api/methods/sync_08.py +106 -0
- ng_bot_api/methods/sync_09.py +97 -0
- ng_bot_api/methods/sync_10.py +92 -0
- ng_bot_api/methods/sync_11.py +107 -0
- ng_bot_api/methods/sync_12.py +119 -0
- ng_bot_api/methods/sync_13.py +119 -0
- ng_bot_api/methods/sync_14.py +113 -0
- ng_bot_api/methods/sync_15.py +117 -0
- ng_bot_api/methods/sync_16.py +115 -0
- ng_bot_api/methods/sync_17.py +121 -0
- ng_bot_api/methods/sync_18.py +118 -0
- ng_bot_api/methods/sync_19.py +128 -0
- ng_bot_api/methods/sync_20.py +115 -0
- ng_bot_api/methods/sync_21.py +127 -0
- ng_bot_api/methods/sync_22.py +110 -0
- ng_bot_api/methods/sync_23.py +116 -0
- ng_bot_api/methods/sync_24.py +118 -0
- ng_bot_api/methods/sync_25.py +109 -0
- ng_bot_api/methods/sync_26.py +124 -0
- ng_bot_api/methods/sync_27.py +119 -0
- ng_bot_api/methods/sync_28.py +119 -0
- ng_bot_api/methods/sync_29.py +108 -0
- ng_bot_api/methods/sync_30.py +115 -0
- ng_bot_api/methods/sync_31.py +112 -0
- ng_bot_api/methods/sync_32.py +126 -0
- ng_bot_api/methods/sync_33.py +105 -0
- ng_bot_api/methods/sync_34.py +117 -0
- ng_bot_api/methods/sync_35.py +122 -0
- ng_bot_api/methods/sync_36.py +121 -0
- ng_bot_api/methods/sync_37.py +126 -0
- ng_bot_api/methods/sync_38.py +112 -0
- ng_bot_api/methods/sync_39.py +84 -0
- ng_bot_api/methods/sync_40.py +125 -0
- ng_bot_api/methods/sync_41.py +115 -0
- ng_bot_api/methods/sync_42.py +30 -0
- ng_bot_api/py.typed +0 -0
- ng_bot_api/sync_bot.py +95 -0
- ng_bot_api/types/__init__.py +82 -0
- ng_bot_api/types/available_types_01.py +102 -0
- ng_bot_api/types/available_types_02.py +141 -0
- ng_bot_api/types/available_types_03.py +311 -0
- ng_bot_api/types/available_types_04.py +84 -0
- ng_bot_api/types/available_types_05.py +134 -0
- ng_bot_api/types/available_types_06.py +126 -0
- ng_bot_api/types/available_types_07.py +119 -0
- ng_bot_api/types/available_types_08.py +120 -0
- ng_bot_api/types/available_types_09.py +115 -0
- ng_bot_api/types/available_types_10.py +109 -0
- ng_bot_api/types/available_types_11.py +121 -0
- ng_bot_api/types/available_types_12.py +120 -0
- ng_bot_api/types/available_types_13.py +128 -0
- ng_bot_api/types/available_types_14.py +124 -0
- ng_bot_api/types/available_types_15.py +129 -0
- ng_bot_api/types/available_types_16.py +121 -0
- ng_bot_api/types/available_types_17.py +124 -0
- ng_bot_api/types/available_types_18.py +128 -0
- ng_bot_api/types/available_types_19.py +115 -0
- ng_bot_api/types/available_types_20.py +123 -0
- ng_bot_api/types/available_types_21.py +101 -0
- ng_bot_api/types/available_types_22.py +121 -0
- ng_bot_api/types/available_types_23.py +128 -0
- ng_bot_api/types/available_types_24.py +107 -0
- ng_bot_api/types/available_types_25.py +100 -0
- ng_bot_api/types/available_types_26.py +81 -0
- ng_bot_api/types/available_types_27.py +114 -0
- ng_bot_api/types/available_types_28.py +125 -0
- ng_bot_api/types/available_types_29.py +118 -0
- ng_bot_api/types/available_types_30.py +113 -0
- ng_bot_api/types/available_types_31.py +120 -0
- ng_bot_api/types/available_types_32.py +124 -0
- ng_bot_api/types/available_types_33.py +125 -0
- ng_bot_api/types/available_types_34.py +113 -0
- ng_bot_api/types/available_types_35.py +125 -0
- ng_bot_api/types/available_types_36.py +119 -0
- ng_bot_api/types/available_types_37.py +126 -0
- ng_bot_api/types/available_types_38.py +118 -0
- ng_bot_api/types/available_types_39.py +121 -0
- ng_bot_api/types/available_types_40.py +121 -0
- ng_bot_api/types/available_types_41.py +116 -0
- ng_bot_api/types/available_types_42.py +112 -0
- ng_bot_api/types/available_types_43.py +110 -0
- ng_bot_api/types/available_types_44.py +30 -0
- ng_bot_api/types/games_01.py +57 -0
- ng_bot_api/types/getting_updates_01.py +123 -0
- ng_bot_api/types/inline_mode_01.py +124 -0
- ng_bot_api/types/inline_mode_02.py +91 -0
- ng_bot_api/types/inline_mode_03.py +116 -0
- ng_bot_api/types/inline_mode_04.py +126 -0
- ng_bot_api/types/inline_mode_05.py +124 -0
- ng_bot_api/types/inline_mode_06.py +124 -0
- ng_bot_api/types/inline_mode_07.py +119 -0
- ng_bot_api/types/inline_mode_08.py +104 -0
- ng_bot_api/types/inline_mode_09.py +84 -0
- ng_bot_api/types/payments_01.py +124 -0
- ng_bot_api/types/payments_02.py +124 -0
- ng_bot_api/types/payments_03.py +119 -0
- ng_bot_api/types/payments_04.py +70 -0
- ng_bot_api/types/rich_messages_01.py +126 -0
- ng_bot_api/types/rich_messages_02.py +125 -0
- ng_bot_api/types/rich_messages_03.py +115 -0
- ng_bot_api/types/rich_messages_04.py +116 -0
- ng_bot_api/types/rich_messages_05.py +128 -0
- ng_bot_api/types/rich_messages_06.py +125 -0
- ng_bot_api/types/rich_messages_07.py +114 -0
- ng_bot_api/types/rich_messages_08.py +118 -0
- ng_bot_api/types/rich_messages_09.py +124 -0
- ng_bot_api/types/rich_messages_10.py +125 -0
- ng_bot_api/types/rich_messages_11.py +122 -0
- ng_bot_api/types/rich_messages_12.py +122 -0
- ng_bot_api/types/stickers_01.py +107 -0
- ng_bot_api/types/telegram_passport_01.py +120 -0
- ng_bot_api/types/telegram_passport_02.py +113 -0
- ng_bot_api/types/telegram_passport_03.py +24 -0
- ng_bot_api/types/unions_01.py +140 -0
- ng_bot_api/types/unions_02.py +132 -0
- ng_bot_api/types/unions_03.py +134 -0
- ng_bot_api/types/unions_04.py +149 -0
- ng_bot_api/types/unions_05.py +96 -0
- ng_bot_api/webhook.py +78 -0
- ng_bot_api-0.1.0.dist-info/METADATA +179 -0
- ng_bot_api-0.1.0.dist-info/RECORD +193 -0
- ng_bot_api-0.1.0.dist-info/WHEEL +4 -0
- ng_bot_api-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from ..core.base import BotObject
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .rich_messages_05 import RichBlockListItem
|
|
10
|
+
from .unions_03 import RichText
|
|
11
|
+
from .unions_04 import RichBlock
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
'RichBlockAnchor', 'RichBlockBlockQuotation', 'RichBlockDivider', 'RichBlockFooter',
|
|
15
|
+
'RichBlockList', 'RichBlockMathematicalExpression', 'RichBlockPreformatted',
|
|
16
|
+
'RichBlockSectionHeading',
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass(kw_only=True, slots=True)
|
|
21
|
+
class RichBlockSectionHeading(BotObject):
|
|
22
|
+
"""A section heading, corresponding to the HTML tags <h1>, <h2>, <h3>, <h4>, <h5>, or <h6>.
|
|
23
|
+
|
|
24
|
+
https://core.telegram.org/bots/api#richblocksectionheading
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
type: str = 'heading'
|
|
28
|
+
"""Type of the block, always “heading”"""
|
|
29
|
+
text: RichText
|
|
30
|
+
"""Text of the block"""
|
|
31
|
+
size: int
|
|
32
|
+
"""Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest"""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass(kw_only=True, slots=True)
|
|
36
|
+
class RichBlockPreformatted(BotObject):
|
|
37
|
+
"""A preformatted text block, corresponding to the nested HTML tags <pre> and <code>.
|
|
38
|
+
|
|
39
|
+
https://core.telegram.org/bots/api#richblockpreformatted
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
type: str = 'pre'
|
|
43
|
+
"""Type of the block, always “pre”"""
|
|
44
|
+
text: RichText
|
|
45
|
+
"""Text of the block"""
|
|
46
|
+
language: str | None = None
|
|
47
|
+
"""Optional. The programming language of the text"""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(kw_only=True, slots=True)
|
|
51
|
+
class RichBlockFooter(BotObject):
|
|
52
|
+
"""A footer, corresponding to the HTML tag <footer>.
|
|
53
|
+
|
|
54
|
+
https://core.telegram.org/bots/api#richblockfooter
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
type: str = 'footer'
|
|
58
|
+
"""Type of the block, always “footer”"""
|
|
59
|
+
text: RichText
|
|
60
|
+
"""Text of the block"""
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@dataclass(kw_only=True, slots=True)
|
|
64
|
+
class RichBlockDivider(BotObject):
|
|
65
|
+
"""A divider, corresponding to the HTML tag <hr/>.
|
|
66
|
+
|
|
67
|
+
https://core.telegram.org/bots/api#richblockdivider
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
type: str = 'divider'
|
|
71
|
+
"""Type of the block, always “divider”"""
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(kw_only=True, slots=True)
|
|
75
|
+
class RichBlockMathematicalExpression(BotObject):
|
|
76
|
+
"""A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag <tg-math-block>.
|
|
77
|
+
|
|
78
|
+
https://core.telegram.org/bots/api#richblockmathematicalexpression
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
type: str = 'mathematical_expression'
|
|
82
|
+
"""Type of the block, always “mathematical_expression”"""
|
|
83
|
+
expression: str
|
|
84
|
+
"""The mathematical expression in LaTeX format"""
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@dataclass(kw_only=True, slots=True)
|
|
88
|
+
class RichBlockAnchor(BotObject):
|
|
89
|
+
"""A block with an anchor, corresponding to the HTML tag <a> with the attribute name.
|
|
90
|
+
|
|
91
|
+
https://core.telegram.org/bots/api#richblockanchor
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
type: str = 'anchor'
|
|
95
|
+
"""Type of the block, always “anchor”"""
|
|
96
|
+
name: str
|
|
97
|
+
"""The name of the anchor"""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass(kw_only=True, slots=True)
|
|
101
|
+
class RichBlockList(BotObject):
|
|
102
|
+
"""A list of blocks, corresponding to the HTML tag <ul> or <ol> with multiple nested tags <li>.
|
|
103
|
+
|
|
104
|
+
https://core.telegram.org/bots/api#richblocklist
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
type: str = 'list'
|
|
108
|
+
"""Type of the block, always “list”"""
|
|
109
|
+
items: list[RichBlockListItem]
|
|
110
|
+
"""Items of the list"""
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@dataclass(kw_only=True, slots=True)
|
|
114
|
+
class RichBlockBlockQuotation(BotObject):
|
|
115
|
+
"""A block quotation, corresponding to the HTML tag <blockquote>.
|
|
116
|
+
|
|
117
|
+
https://core.telegram.org/bots/api#richblockblockquotation
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
type: str = 'blockquote'
|
|
121
|
+
"""Type of the block, always “blockquote”"""
|
|
122
|
+
blocks: list[RichBlock]
|
|
123
|
+
"""Content of the block"""
|
|
124
|
+
credit: RichText | None = None
|
|
125
|
+
"""Optional. Credit of the block"""
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from ..core.base import BotObject
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .rich_messages_05 import RichBlockCaption, RichBlockTableCell
|
|
10
|
+
from .unions_03 import RichText
|
|
11
|
+
from .unions_04 import RichBlock
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
'RichBlockCollage', 'RichBlockDetails', 'RichBlockExpandableBlockQuotation',
|
|
15
|
+
'RichBlockPullQuotation', 'RichBlockSlideshow', 'RichBlockTable',
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass(kw_only=True, slots=True)
|
|
20
|
+
class RichBlockExpandableBlockQuotation(BotObject):
|
|
21
|
+
"""A block quotation, corresponding to the HTML tag <blockquote> with the custom attribute "expandable".
|
|
22
|
+
|
|
23
|
+
https://core.telegram.org/bots/api#richblockexpandableblockquotation
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
type: str = 'expandable_blockquote'
|
|
27
|
+
"""Type of the block, always “expandable_blockquote”"""
|
|
28
|
+
blocks: list[RichBlock]
|
|
29
|
+
"""Content of the block"""
|
|
30
|
+
credit: RichText | None = None
|
|
31
|
+
"""Optional. Credit of the block"""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dataclass(kw_only=True, slots=True)
|
|
35
|
+
class RichBlockPullQuotation(BotObject):
|
|
36
|
+
"""A quotation with centered text, loosely corresponding to the HTML tag <aside>.
|
|
37
|
+
|
|
38
|
+
https://core.telegram.org/bots/api#richblockpullquotation
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
type: str = 'pullquote'
|
|
42
|
+
"""Type of the block, always “pullquote”"""
|
|
43
|
+
text: RichText
|
|
44
|
+
"""Text of the block"""
|
|
45
|
+
credit: RichText | None = None
|
|
46
|
+
"""Optional. Credit of the block"""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@dataclass(kw_only=True, slots=True)
|
|
50
|
+
class RichBlockCollage(BotObject):
|
|
51
|
+
"""A collage, corresponding to the custom HTML tag <tg-collage>.
|
|
52
|
+
|
|
53
|
+
https://core.telegram.org/bots/api#richblockcollage
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
type: str = 'collage'
|
|
57
|
+
"""Type of the block, always “collage”"""
|
|
58
|
+
blocks: list[RichBlock]
|
|
59
|
+
"""Elements of the collage"""
|
|
60
|
+
caption: RichBlockCaption | None = None
|
|
61
|
+
"""Optional. Caption of the block"""
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(kw_only=True, slots=True)
|
|
65
|
+
class RichBlockSlideshow(BotObject):
|
|
66
|
+
"""A slideshow, corresponding to the custom HTML tag <tg-slideshow>.
|
|
67
|
+
|
|
68
|
+
https://core.telegram.org/bots/api#richblockslideshow
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
type: str = 'slideshow'
|
|
72
|
+
"""Type of the block, always “slideshow”"""
|
|
73
|
+
blocks: list[RichBlock]
|
|
74
|
+
"""Elements of the slideshow"""
|
|
75
|
+
caption: RichBlockCaption | None = None
|
|
76
|
+
"""Optional. Caption of the block"""
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass(kw_only=True, slots=True)
|
|
80
|
+
class RichBlockTable(BotObject):
|
|
81
|
+
"""A table, corresponding to the HTML tag <table>.
|
|
82
|
+
|
|
83
|
+
https://core.telegram.org/bots/api#richblocktable
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
type: str = 'table'
|
|
87
|
+
"""Type of the block, always “table”"""
|
|
88
|
+
cells: list[list[RichBlockTableCell]]
|
|
89
|
+
"""Cells of the table"""
|
|
90
|
+
is_bordered: bool | None = None
|
|
91
|
+
"""Optional. True, if the table has borders"""
|
|
92
|
+
is_striped: bool | None = None
|
|
93
|
+
"""Optional. True, if the table is striped"""
|
|
94
|
+
is_compact: bool | None = None
|
|
95
|
+
"""Optional. True, if table cells have smaller indents"""
|
|
96
|
+
caption: RichText | None = None
|
|
97
|
+
"""Optional. Caption of the table"""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass(kw_only=True, slots=True)
|
|
101
|
+
class RichBlockDetails(BotObject):
|
|
102
|
+
"""An expandable block for details disclosure, corresponding to the HTML tag <details>.
|
|
103
|
+
|
|
104
|
+
https://core.telegram.org/bots/api#richblockdetails
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
type: str = 'details'
|
|
108
|
+
"""Type of the block, always “details”"""
|
|
109
|
+
summary: RichText
|
|
110
|
+
"""Always shown summary of the block"""
|
|
111
|
+
blocks: list[RichBlock]
|
|
112
|
+
"""Content of the block"""
|
|
113
|
+
is_open: bool | None = None
|
|
114
|
+
"""Optional. True, if the content of the block is visible by default"""
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from ..core.base import BotObject
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .available_types_06 import Animation, PhotoSize
|
|
10
|
+
from .available_types_07 import Audio, Document
|
|
11
|
+
from .available_types_12 import Location
|
|
12
|
+
from .rich_messages_01 import RichMessageButton
|
|
13
|
+
from .rich_messages_05 import RichBlockCaption
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
'RichBlockAnimation', 'RichBlockAudio', 'RichBlockButtons', 'RichBlockDocument',
|
|
17
|
+
'RichBlockMap', 'RichBlockPhoto',
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass(kw_only=True, slots=True)
|
|
22
|
+
class RichBlockMap(BotObject):
|
|
23
|
+
"""A block with a map, corresponding to the custom HTML tag <tg-map>.
|
|
24
|
+
|
|
25
|
+
https://core.telegram.org/bots/api#richblockmap
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
type: str = 'map'
|
|
29
|
+
"""Type of the block, always “map”"""
|
|
30
|
+
location: Location
|
|
31
|
+
"""Location of the center of the map"""
|
|
32
|
+
zoom: int
|
|
33
|
+
"""Map zoom level"""
|
|
34
|
+
width: int
|
|
35
|
+
"""Expected width of the map"""
|
|
36
|
+
height: int
|
|
37
|
+
"""Expected height of the map"""
|
|
38
|
+
caption: RichBlockCaption | None = None
|
|
39
|
+
"""Optional. Caption of the block"""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass(kw_only=True, slots=True)
|
|
43
|
+
class RichBlockButtons(BotObject):
|
|
44
|
+
"""A block containing a list of buttons that are shown in one row, corresponding to the custom HTML tag <tg-button-row>.
|
|
45
|
+
|
|
46
|
+
https://core.telegram.org/bots/api#richblockbuttons
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
type: str = 'buttons'
|
|
50
|
+
"""Type of the block, always “buttons”"""
|
|
51
|
+
buttons: list[RichMessageButton]
|
|
52
|
+
"""The buttons"""
|
|
53
|
+
align: str | None = None
|
|
54
|
+
"""Optional. Horizontal alignment of the buttons. Currently, must be one of “left”, “center”, or “right”."""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(kw_only=True, slots=True)
|
|
58
|
+
class RichBlockAnimation(BotObject):
|
|
59
|
+
"""A block with an animation, corresponding to the HTML tag <video>.
|
|
60
|
+
|
|
61
|
+
https://core.telegram.org/bots/api#richblockanimation
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
type: str = 'animation'
|
|
65
|
+
"""Type of the block, always “animation”"""
|
|
66
|
+
animation: Animation
|
|
67
|
+
"""The animation"""
|
|
68
|
+
has_spoiler: bool | None = None
|
|
69
|
+
"""Optional. True, if the media preview is covered by a spoiler animation"""
|
|
70
|
+
caption: RichBlockCaption | None = None
|
|
71
|
+
"""Optional. Caption of the block"""
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(kw_only=True, slots=True)
|
|
75
|
+
class RichBlockAudio(BotObject):
|
|
76
|
+
"""A block with a music file, corresponding to the HTML tag <audio>.
|
|
77
|
+
|
|
78
|
+
https://core.telegram.org/bots/api#richblockaudio
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
type: str = 'audio'
|
|
82
|
+
"""Type of the block, always “audio”"""
|
|
83
|
+
audio: Audio
|
|
84
|
+
"""The audio"""
|
|
85
|
+
caption: RichBlockCaption | None = None
|
|
86
|
+
"""Optional. Caption of the block"""
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@dataclass(kw_only=True, slots=True)
|
|
90
|
+
class RichBlockDocument(BotObject):
|
|
91
|
+
"""A block with a general file, corresponding to the custom HTML tag <tg-document>.
|
|
92
|
+
|
|
93
|
+
https://core.telegram.org/bots/api#richblockdocument
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
type: str = 'document'
|
|
97
|
+
"""Type of the block, always “document”"""
|
|
98
|
+
document: Document
|
|
99
|
+
"""The document"""
|
|
100
|
+
caption: RichBlockCaption | None = None
|
|
101
|
+
"""Optional. Caption of the block"""
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@dataclass(kw_only=True, slots=True)
|
|
105
|
+
class RichBlockPhoto(BotObject):
|
|
106
|
+
"""A block with a photo, corresponding to the HTML tag <img>.
|
|
107
|
+
|
|
108
|
+
https://core.telegram.org/bots/api#richblockphoto
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
type: str = 'photo'
|
|
112
|
+
"""Type of the block, always “photo”"""
|
|
113
|
+
photo: list[PhotoSize]
|
|
114
|
+
"""Available sizes of the photo"""
|
|
115
|
+
has_spoiler: bool | None = None
|
|
116
|
+
"""Optional. True, if the media preview is covered by a spoiler animation"""
|
|
117
|
+
caption: RichBlockCaption | None = None
|
|
118
|
+
"""Optional. Caption of the block"""
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from ..core.base import BotObject
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .available_types_08 import Video, Voice
|
|
10
|
+
from .rich_messages_05 import RichBlockCaption
|
|
11
|
+
from .unions_03 import RichText
|
|
12
|
+
from .unions_04 import InputRichBlock
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
'InputRichBlockListItem', 'InputRichBlockParagraph', 'InputRichBlockPreformatted',
|
|
16
|
+
'InputRichBlockSectionHeading', 'RichBlockThinking', 'RichBlockVideo', 'RichBlockVoiceNote',
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass(kw_only=True, slots=True)
|
|
21
|
+
class RichBlockVideo(BotObject):
|
|
22
|
+
"""A block with a video, corresponding to the HTML tag <video>.
|
|
23
|
+
|
|
24
|
+
https://core.telegram.org/bots/api#richblockvideo
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
type: str = 'video'
|
|
28
|
+
"""Type of the block, always “video”"""
|
|
29
|
+
video: Video
|
|
30
|
+
"""The video"""
|
|
31
|
+
has_spoiler: bool | None = None
|
|
32
|
+
"""Optional. True, if the media preview is covered by a spoiler animation"""
|
|
33
|
+
caption: RichBlockCaption | None = None
|
|
34
|
+
"""Optional. Caption of the block"""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass(kw_only=True, slots=True)
|
|
38
|
+
class RichBlockVoiceNote(BotObject):
|
|
39
|
+
"""A block with a voice note, corresponding to the HTML tag <audio>.
|
|
40
|
+
|
|
41
|
+
https://core.telegram.org/bots/api#richblockvoicenote
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
type: str = 'voice_note'
|
|
45
|
+
"""Type of the block, always “voice_note”"""
|
|
46
|
+
voice_note: Voice
|
|
47
|
+
"""The voice note"""
|
|
48
|
+
caption: RichBlockCaption | None = None
|
|
49
|
+
"""Optional. Caption of the block"""
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass(kw_only=True, slots=True)
|
|
53
|
+
class RichBlockThinking(BotObject):
|
|
54
|
+
"""A block with a “Thinking…” placeholder, corresponding to the custom HTML tag <tg-thinking>. The block may be used only in sendRichMessageDraft; therefore, it can't be received in messages. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block.
|
|
55
|
+
|
|
56
|
+
https://core.telegram.org/bots/api#richblockthinking
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
type: str = 'thinking'
|
|
60
|
+
"""Type of the block, always “thinking”"""
|
|
61
|
+
text: RichText
|
|
62
|
+
"""Text of the block. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block."""
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@dataclass(kw_only=True, slots=True)
|
|
66
|
+
class InputRichBlockListItem(BotObject):
|
|
67
|
+
"""An item of a list to be sent.
|
|
68
|
+
|
|
69
|
+
https://core.telegram.org/bots/api#inputrichblocklistitem
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
blocks: list[InputRichBlock]
|
|
73
|
+
"""The content of the item"""
|
|
74
|
+
has_checkbox: bool | None = None
|
|
75
|
+
"""Optional. Pass True if the item has a checkbox"""
|
|
76
|
+
is_checked: bool | None = None
|
|
77
|
+
"""Optional. Pass True if the item has a checked checkbox"""
|
|
78
|
+
value: int | None = None
|
|
79
|
+
"""Optional. For ordered lists, the numeric value of the item label"""
|
|
80
|
+
type: str | None = None
|
|
81
|
+
"""Optional. For ordered lists, the type of the item label; must be one of “a” for lowercase letters, “A” for uppercase letters, “i” for lowercase Roman numerals, “I” for uppercase Roman numerals, or “1” for decimal numbers"""
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@dataclass(kw_only=True, slots=True)
|
|
85
|
+
class InputRichBlockParagraph(BotObject):
|
|
86
|
+
"""A text paragraph, corresponding to the HTML tag <p>.
|
|
87
|
+
|
|
88
|
+
https://core.telegram.org/bots/api#inputrichblockparagraph
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
type: str = 'paragraph'
|
|
92
|
+
"""Type of the block, always “paragraph”"""
|
|
93
|
+
text: RichText
|
|
94
|
+
"""Text of the block"""
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@dataclass(kw_only=True, slots=True)
|
|
98
|
+
class InputRichBlockSectionHeading(BotObject):
|
|
99
|
+
"""A section heading, corresponding to the HTML tags <h1>, <h2>, <h3>, <h4>, <h5>, or <h6>.
|
|
100
|
+
|
|
101
|
+
https://core.telegram.org/bots/api#inputrichblocksectionheading
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
type: str = 'heading'
|
|
105
|
+
"""Type of the block, always “heading”"""
|
|
106
|
+
text: RichText
|
|
107
|
+
"""Text of the block"""
|
|
108
|
+
size: int
|
|
109
|
+
"""Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest"""
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@dataclass(kw_only=True, slots=True)
|
|
113
|
+
class InputRichBlockPreformatted(BotObject):
|
|
114
|
+
"""A preformatted text block, corresponding to the nested HTML tags <pre> and <code>.
|
|
115
|
+
|
|
116
|
+
https://core.telegram.org/bots/api#inputrichblockpreformatted
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
type: str = 'pre'
|
|
120
|
+
"""Type of the block, always “pre”"""
|
|
121
|
+
text: RichText
|
|
122
|
+
"""Text of the block"""
|
|
123
|
+
language: str | None = None
|
|
124
|
+
"""Optional. The programming language of the text"""
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from ..core.base import BotObject
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .rich_messages_09 import InputRichBlockListItem
|
|
10
|
+
from .unions_03 import RichText
|
|
11
|
+
from .unions_04 import InputRichBlock
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
'InputRichBlockAnchor', 'InputRichBlockBlockQuotation', 'InputRichBlockDivider',
|
|
15
|
+
'InputRichBlockExpandableBlockQuotation', 'InputRichBlockFooter', 'InputRichBlockList',
|
|
16
|
+
'InputRichBlockMathematicalExpression', 'InputRichBlockPullQuotation',
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass(kw_only=True, slots=True)
|
|
21
|
+
class InputRichBlockFooter(BotObject):
|
|
22
|
+
"""A footer, corresponding to the HTML tag <footer>.
|
|
23
|
+
|
|
24
|
+
https://core.telegram.org/bots/api#inputrichblockfooter
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
type: str = 'footer'
|
|
28
|
+
"""Type of the block, always “footer”"""
|
|
29
|
+
text: RichText
|
|
30
|
+
"""Text of the block"""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(kw_only=True, slots=True)
|
|
34
|
+
class InputRichBlockDivider(BotObject):
|
|
35
|
+
"""A divider, corresponding to the HTML tag <hr/>.
|
|
36
|
+
|
|
37
|
+
https://core.telegram.org/bots/api#inputrichblockdivider
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
type: str = 'divider'
|
|
41
|
+
"""Type of the block, always “divider”"""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(kw_only=True, slots=True)
|
|
45
|
+
class InputRichBlockMathematicalExpression(BotObject):
|
|
46
|
+
"""A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag <tg-math-block>.
|
|
47
|
+
|
|
48
|
+
https://core.telegram.org/bots/api#inputrichblockmathematicalexpression
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
type: str = 'mathematical_expression'
|
|
52
|
+
"""Type of the block, always “mathematical_expression”"""
|
|
53
|
+
expression: str
|
|
54
|
+
"""The mathematical expression in LaTeX format"""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(kw_only=True, slots=True)
|
|
58
|
+
class InputRichBlockAnchor(BotObject):
|
|
59
|
+
"""A block with an anchor, corresponding to the HTML tag <a> with the attribute name.
|
|
60
|
+
|
|
61
|
+
https://core.telegram.org/bots/api#inputrichblockanchor
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
type: str = 'anchor'
|
|
65
|
+
"""Type of the block, always “anchor”"""
|
|
66
|
+
name: str
|
|
67
|
+
"""The name of the anchor"""
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass(kw_only=True, slots=True)
|
|
71
|
+
class InputRichBlockList(BotObject):
|
|
72
|
+
"""A list of blocks, corresponding to the HTML tag <ul> or <ol> with multiple nested tags <li>.
|
|
73
|
+
|
|
74
|
+
https://core.telegram.org/bots/api#inputrichblocklist
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
type: str = 'list'
|
|
78
|
+
"""Type of the block, always “list”"""
|
|
79
|
+
items: list[InputRichBlockListItem]
|
|
80
|
+
"""Items of the list"""
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@dataclass(kw_only=True, slots=True)
|
|
84
|
+
class InputRichBlockBlockQuotation(BotObject):
|
|
85
|
+
"""A block quotation, corresponding to the HTML tag <blockquote>.
|
|
86
|
+
|
|
87
|
+
https://core.telegram.org/bots/api#inputrichblockblockquotation
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
type: str = 'blockquote'
|
|
91
|
+
"""Type of the block, always “blockquote”"""
|
|
92
|
+
blocks: list[InputRichBlock]
|
|
93
|
+
"""Content of the block"""
|
|
94
|
+
credit: RichText | None = None
|
|
95
|
+
"""Optional. Credit of the block"""
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@dataclass(kw_only=True, slots=True)
|
|
99
|
+
class InputRichBlockExpandableBlockQuotation(BotObject):
|
|
100
|
+
"""A block quotation, corresponding to the HTML tag <blockquote> with the custom attribute "expandable".
|
|
101
|
+
|
|
102
|
+
https://core.telegram.org/bots/api#inputrichblockexpandableblockquotation
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
type: str = 'expandable_blockquote'
|
|
106
|
+
"""Type of the block, always “expandable_blockquote”"""
|
|
107
|
+
blocks: list[InputRichBlock]
|
|
108
|
+
"""Content of the block"""
|
|
109
|
+
credit: RichText | None = None
|
|
110
|
+
"""Optional. Credit of the block"""
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@dataclass(kw_only=True, slots=True)
|
|
114
|
+
class InputRichBlockPullQuotation(BotObject):
|
|
115
|
+
"""A quotation with centered text, loosely corresponding to the HTML tag <aside>.
|
|
116
|
+
|
|
117
|
+
https://core.telegram.org/bots/api#inputrichblockpullquotation
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
type: str = 'pullquote'
|
|
121
|
+
"""Type of the block, always “pullquote”"""
|
|
122
|
+
text: RichText
|
|
123
|
+
"""Text of the block"""
|
|
124
|
+
credit: RichText | None = None
|
|
125
|
+
"""Optional. Credit of the block"""
|