Модели¶
Message¶
Message ¶
Bases: BaseMaxObject
status
class-attribute
instance-attribute
¶
status: Literal[
"EDITED", "REPLY", "USER", "REMOVED", "SHARE", "OTHER"
] = "USER"
attaches
instance-attribute
¶
attaches: list[
VideoAttachment
| VideoNoteAttachment
| VoiceAttachment
| FileAttachment
| PhotoAttachment
| Poll[Never]
| Any
]
answer
async
¶
answer(
text: str | None = None,
attaches: list[BaseFileAttachment] | None = None,
link: MessageLink | None = None,
) -> Any
Answer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str | None
|
Message or textual content. |
None
|
attaches
|
list[BaseFileAttachment] | None
|
Attachments associated with the message. |
None
|
link
|
MessageLink | None
|
Invite, message, or resource link. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The value returned by the wrapped callable or backend. |
Source code in src/pyromax/models/Message.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
reply
async
¶
reply(
text: str | None = None,
attaches: list[BaseFileAttachment] | None = None,
) -> Any
Reply.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str | None
|
Message or textual content. |
None
|
attaches
|
list[BaseFileAttachment] | None
|
Attachments associated with the message. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The value returned by the wrapped callable or backend. |
Source code in src/pyromax/models/Message.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
forward
async
¶
forward(
chat_id: int, *, notify: bool = True
) -> Message | None
Forward.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
notify
|
bool
|
Whether MAX should notify affected users. |
True
|
Returns:
| Type | Description |
|---|---|
Message | None
|
The resulting Message | None value. |
Source code in src/pyromax/models/Message.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
pin
async
¶
pin(notify_pin: bool = True) -> None
Pin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
notify_pin
|
bool
|
Whether MAX should notify affected users. |
True
|
Source code in src/pyromax/models/Message.py
128 129 130 131 132 133 134 135 136 137 138 | |
edit
async
¶
edit(
text: str | None = None,
attachments: list[BaseFileAttachment] | None = None,
) -> Message
Edit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str | None
|
Message or textual content. |
None
|
attachments
|
list[BaseFileAttachment] | None
|
Attachments associated with the message. |
None
|
Returns:
| Type | Description |
|---|---|
Message
|
The resulting Message value. |
Source code in src/pyromax/models/Message.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
delete
async
¶
delete(for_me: bool = False) -> None
Delete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
for_me
|
bool
|
Delete only for the current account. |
False
|
Source code in src/pyromax/models/Message.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
read
async
¶
read() -> ReadState
Read.
Returns:
| Type | Description |
|---|---|
ReadState
|
The resulting ReadState value. |
Source code in src/pyromax/models/Message.py
178 179 180 181 182 183 184 185 186 187 | |
react
async
¶
react(reaction: str) -> EmojiReaction | None
React.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reaction
|
str
|
The reaction value. |
required |
Returns:
| Type | Description |
|---|---|
EmojiReaction | None
|
The resulting EmojiReaction | None value. |
Source code in src/pyromax/models/Message.py
189 190 191 192 193 194 195 196 197 198 199 200 201 | |
unreact
async
¶
unreact() -> EmojiReaction | None
Unreact.
Returns:
| Type | Description |
|---|---|
EmojiReaction | None
|
The resulting EmojiReaction | None value. |
Source code in src/pyromax/models/Message.py
203 204 205 206 207 208 209 210 211 212 | |
get_reactions
async
¶
get_reactions() -> dict[str, EmojiReaction] | None
Retrieve reactions.
Returns:
| Type | Description |
|---|---|
dict[str, EmojiReaction] | None
|
The resulting dict[str, EmojiReaction] | None value. |
Source code in src/pyromax/models/Message.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
Chat¶
Chat ¶
Bases: BaseMaxObject
participants
class-attribute
instance-attribute
¶
participants: dict[int, int] = Field(default_factory=dict)
last_fire_delayed_error_time
class-attribute
instance-attribute
¶
last_fire_delayed_error_time: int = 0
access
class-attribute
instance-attribute
¶
access: Literal["PUBLIC", "PRIVATE", "SECRET"] | None = None
admin_participants
class-attribute
instance-attribute
¶
admin_participants: dict[int, dict[Any, Any]] = Field(
default_factory=dict
)
is_dialog
property
¶
is_dialog: bool
Return whether dialog.
Returns:
| Type | Description |
|---|---|
bool
|
|
is_group
property
¶
is_group: bool
Return whether group.
Returns:
| Type | Description |
|---|---|
bool
|
|
is_channel
property
¶
is_channel: bool
Return whether channel.
Returns:
| Type | Description |
|---|---|
bool
|
|
answer
async
¶
answer(
text: str | None = None,
link: MessageLink | None = None,
attaches: list[BaseFileAttachment] | None = None,
notify: bool = True,
) -> Message | None
Answer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str | None
|
Message or textual content. |
None
|
link
|
MessageLink | None
|
Message link to another message(s). |
None
|
attaches
|
list[BaseFileAttachment] | None
|
Attachments associated with the message. |
None
|
notify
|
bool
|
Whether MAX should notify affected users. |
True
|
Returns:
| Type | Description |
|---|---|
Message | None
|
The resulting Message | None value. |
Source code in src/pyromax/models/Chat.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
history
async
¶
history(
forward: int = ...,
backward: int = ...,
backward_time: int = ...,
forward_time: int = ...,
from_time: int | None = ...,
item_type: Literal["DELAYED", "REGULAR"] = ...,
get_chat: Literal[False] = False,
get_messages: Literal[True] = True,
interactive: bool = ...,
) -> list[Message]
history(
forward: int = ...,
backward: int = ...,
backward_time: int = ...,
forward_time: int = ...,
from_time: int | None = None,
item_type: Literal["DELAYED", "REGULAR"] = ...,
get_chat: Literal[True] = True,
get_messages: Literal[True] = True,
interactive: bool = ...,
) -> tuple[list[Message], Chat | None]
history(
forward: int = ...,
backward: int = ...,
backward_time: int = ...,
forward_time: int = ...,
from_time: int | None = None,
item_type: Literal["DELAYED", "REGULAR"] = ...,
get_chat: Literal[False] = False,
get_messages: Literal[False] = False,
interactive: bool = ...,
) -> list[str | int]
history(
forward: int = ...,
backward: int = ...,
backward_time: int = ...,
forward_time: int = ...,
from_time: int | None = None,
item_type: Literal["DELAYED", "REGULAR"] = ...,
get_chat: Literal[True] = True,
get_messages: Literal[False] = False,
interactive: bool = ...,
) -> tuple[list[str | int], Chat | None]
history(
forward: int = ...,
backward: int = ...,
backward_time: int = ...,
forward_time: int = ...,
from_time: int | None = None,
item_type: Literal["DELAYED", "REGULAR"] = ...,
get_chat: bool = ...,
get_messages: bool = ...,
interactive: bool = ...,
) -> (
list[Message]
| list[str | int]
| tuple[list[Message] | list[str | int], Chat | None]
)
history(
forward: int = 0,
backward: int = 40,
backward_time: int = 0,
forward_time: int = 0,
from_time: int | None = None,
item_type: Literal["DELAYED", "REGULAR"] = "REGULAR",
get_chat: bool = False,
get_messages: bool = True,
interactive: bool = False,
) -> (
list[Message]
| list[str | int]
| tuple[list[Message] | list[str | int], Chat | None]
)
Retrieve chat history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
forward
|
int
|
How many messages to load ahead from |
0
|
backward
|
int
|
How many messages to load back from |
40
|
backward_time
|
int
|
Look-back time window in milliseconds. |
0
|
forward_time
|
int
|
Forward time window in milliseconds. |
0
|
from_time
|
int | None
|
The reference point in Unix time (milliseconds). If |
None
|
item_type
|
Literal['DELAYED', 'REGULAR']
|
History item type. |
'REGULAR'
|
get_chat
|
bool
|
Request chat data along with the history. |
False
|
get_messages
|
bool
|
The get messages value. |
True
|
interactive
|
bool
|
Request the messages themselves. |
False
|
Returns:
| Type | Description |
|---|---|
list[Message] | list[str | int] | tuple[list[Message] | list[str | int], Chat | None]
|
History items, paired with the requested chat when |
Source code in src/pyromax/models/Chat.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
get_message
async
¶
get_message(message_id: int | str) -> Message | None
Retrieve message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message_id
|
int | str
|
Identifier of the message. |
required |
Returns:
| Type | Description |
|---|---|
Message | None
|
The resulting Message | None value. |
Source code in src/pyromax/models/Chat.py
272 273 274 275 276 277 278 279 280 281 282 283 | |
get_messages
async
¶
get_messages(
message_ids: Iterable[int] | Iterable[str],
) -> list[Message]
Retrieve messages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message_ids
|
Iterable[int] | Iterable[str]
|
Identifiers of the messages. |
required |
Returns:
| Type | Description |
|---|---|
list[Message]
|
The resulting collection. |
Source code in src/pyromax/models/Chat.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
leave
async
¶
leave() -> None | Message
leave the chat
Raises:
| Type | Description |
|---|---|
RuntimeError
|
if chat is DIALOG |
ValueError
|
if chat type is unknown |
Source code in src/pyromax/models/Chat.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
delete
async
¶
delete(for_all: bool = True) -> None
Delete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
for_all
|
bool
|
Delete only for the current account. |
True
|
Source code in src/pyromax/models/Chat.py
319 320 321 322 323 324 325 326 327 328 | |
invite
async
¶
invite(
user_ids: list[int], show_history: bool = True
) -> Chat | None
invite users to chat
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_ids
|
list[int]
|
Identifiers of the users. |
required |
show_history
|
bool
|
Show message history to new members. |
True
|
Returns:
| Type | Description |
|---|---|
Chat | None
|
The resulting Chat | None value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if try to invite users to unknown chat |
RuntimeError
|
if max_api not linked to chat instance |
Source code in src/pyromax/models/Chat.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
remove_users
async
¶
remove_users(
user_ids: list[int], clean_msg_period: int = 0
) -> Chat | None
Remove users.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_ids
|
list[int]
|
Identifiers of the users. |
required |
clean_msg_period
|
int
|
Cleanup period for messages from removed participants. |
0
|
Source code in src/pyromax/models/Chat.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
pin_message
async
¶
pin_message(
message_id: str | int, notify_pin: bool = True
) -> None
Pin message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message_id
|
str | int
|
Identifier of the message. |
required |
notify_pin
|
bool
|
Whether MAX should notify affected users. |
True
|
Source code in src/pyromax/models/Chat.py
379 380 381 382 383 384 385 386 387 388 389 390 391 | |
update_settings
async
¶
update_settings(
all_can_pin_message: bool | None = None,
only_owner_can_change_icon_title: bool | None = None,
only_admin_can_add_member: bool | None = None,
only_admin_can_call: bool | None = None,
members_can_see_private_link: bool | None = None,
) -> Chat | None
Update settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
all_can_pin_message
|
bool | None
|
The all can pin message. |
None
|
only_owner_can_change_icon_title
|
bool | None
|
The only owner can change icon title. |
None
|
only_admin_can_add_member
|
bool | None
|
The only admin can add member. |
None
|
only_admin_can_call
|
bool | None
|
The only admin can call. |
None
|
members_can_see_private_link
|
bool | None
|
The members can see private link. |
None
|
Source code in src/pyromax/models/Chat.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
revoke_invite_link
async
¶
revoke_invite_link() -> Chat
Revoke invite link.
Returns:
| Type | Description |
|---|---|
Chat
|
The resulting Chat value. |
Source code in src/pyromax/models/Chat.py
423 424 425 426 427 428 429 | |
Contact¶
Contact ¶
Bases: BaseMaxObject
add_contact
async
¶
add_contact() -> Contact
Add contact.
Returns:
| Type | Description |
|---|---|
'Contact'
|
The resulting 'Contact' value. |
Source code in src/pyromax/models/Contact.py
31 32 33 34 35 36 37 38 39 | |
remove_contact
async
¶
remove_contact() -> None
Remove contact.
Source code in src/pyromax/models/Contact.py
42 43 44 45 46 47 | |
get_chat_id
async
¶
get_chat_id(contact_id: int) -> int
Retrieve chat id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contact_id
|
int
|
Identifier of the contact. |
required |
Returns:
| Type | Description |
|---|---|
int
|
chat id. |
Source code in src/pyromax/models/Contact.py
50 51 52 53 54 55 56 57 58 59 60 61 | |
ContactInfo¶
ContactInfo ¶
Profile¶
Profile ¶
Member¶
Member ¶
AuthFlow¶
AuthFlow ¶
Bases: BaseMaxObject, Generic[M, P, T]
EmojiReaction¶
RegistrationConfig¶
RegistrationConfig ¶
Session¶
Session ¶
Bases: BaseMaxObject
PrivacySettings¶
PrivacySettings ¶
Bases: BaseMaxObject
phone_number_visibility
class-attribute
instance-attribute
¶
phone_number_visibility: PrivacyAccess | None = None
Folder¶
Folder ¶
Folder ¶
Bases: BaseMaxObject
FolderUpdate ¶
ErrorEvent¶
ErrorEvent ¶
Вложения¶
Attachments ¶
BaseFileAttachment ¶
Bases: BaseModel
VideoAttachment ¶
Bases: BaseFileAttachment
VoiceAttachment ¶
Bases: BaseFileAttachment
VideoNoteAttachment ¶
Bases: BaseFileAttachment
PhotoAttachment ¶
Bases: BaseFileAttachment
FileAttachment ¶
Bases: BaseFileAttachment
ShareAttachment ¶
Bases: BaseFileAttachment
ControlAttachment ¶
Bases: BaseFileAttachment
Опросы¶
Poll ¶
PollVote ¶
PollResult ¶
PollState ¶
PollAnswer ¶
Bases: BaseMaxObject, Generic[NoneOrNever]
Poll ¶
Bases: BaseFileAttachment, Generic[NoneOrNever]