MaxApi¶
MaxApi — асинхронный высокоуровневый клиент. Он владеет выбранным backend-стеком и предоставляет операции для сообщений, чатов, реакций, опросов, групп, контактов, профиля, папок, сессий, presence и двухфакторной авторизации.
Bases: AsyncInitializerMixin, FullMixin
Asynchronous client for MAX Messenger.
The client initializes a transport, protocol, and mapper from the project registry. Initialization is asynchronous and requires the selected backend names to be available in the corresponding registries.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If a transport, protocol, or mapper name is not supported. |
Initialize the max api.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_type
|
DeviceType | None
|
Device type reported to the API. |
None
|
password
|
str | None
|
Optional account password. |
None
|
auth_callbacks
|
AuthCallbacks | None
|
Callbacks for QR, SMS code, and 2FA password. |
None
|
auth_interactor
|
AuthInteractor | None
|
Custom authentication interaction implementation. |
None
|
token
|
str | None
|
Optional auth token. |
None
|
transport
|
BaseTransport[Any] | None
|
Transport backend name. |
None
|
protocol
|
BaseMaxProtocol[Any, Any] | None
|
Protocol backend name. |
None
|
mapper
|
BaseMapper[Any, Any] | None
|
Mapper backend name. |
None
|
kwargs
|
Any
|
Extra keyword arguments passed to mapper initialization. |
{}
|
workflow_data
|
dict[Any, Any] | None
|
dict[Any, Any] global workflow data. |
None
|
user_agent_params
|
dict[str, Any] | None
|
dict[str, Any] params of user agent. |
required |
auth_middleware_manager
|
AuthMiddlewareManager | None
|
AuthMiddlewareManager instance of auth middleware manager. |
None
|
dispatcher
|
Dispatcher | None
|
Optional source of lifecycle listeners used during asynchronous initialization. It is not stored as this client's dispatcher. |
None
|
registration_config
|
RegistrationConfig | None
|
instance of RegistrationConfig for register account. |
None
|
token_suffix
|
str
|
The token suffix value. |
'MaxApi'
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If transport or protocol or mapper cannot be None. |
Source code in src/pyromax/core/client.py
743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | |
app_version
property
¶
app_version: str | None
Return the application version currently used by the mapper.
shutdown_requested
property
¶
shutdown_requested: bool
Return whether graceful shutdown has been requested.
auth_middleware_manager
instance-attribute
¶
auth_middleware_manager: AuthMiddlewareManager | None = (
auth_middleware_manager
)
_async_init
async
¶
_async_init(
device_type: DeviceType | None = None,
password: str | None = None,
auth_callbacks: AuthCallbacks | None = None,
auth_interactor: AuthInteractor | None = None,
token: str | None = None,
session_id: str | None = None,
phone: str | None = None,
token_suffix: str = "MaxApi",
work_dir: str | None = None,
session_name: str | None = None,
transport: TransportRegistry | None = None,
encoding: EncodingRegistry | None = None,
protocol: ProtocolRegistry | None = None,
mapper: MapperRegistry | None = None,
workflow_data: dict[Any, Any] | None = None,
auth_middleware_manager: (
AuthMiddlewareManager | None
) = None,
dispatcher: Dispatcher | None = None,
extra_config: ExtraConfig | None = None,
**kwargs: Any
) -> None
Asynchronously initialize transport, protocol, and mapper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_type
|
DeviceType | None
|
Device type reported to the API. |
None
|
password
|
str | None
|
Optional account password. |
None
|
auth_callbacks
|
AuthCallbacks | None
|
Callbacks for QR, SMS code, and 2FA password. |
None
|
auth_interactor
|
AuthInteractor | None
|
Custom authentication interaction implementation. |
None
|
token
|
str | None
|
Optional auth token. |
None
|
transport
|
TransportRegistry | None
|
Transport backend name. |
None
|
protocol
|
ProtocolRegistry | None
|
Protocol backend name. |
None
|
mapper
|
MapperRegistry | None
|
Mapper backend name. |
None
|
kwargs
|
Any
|
Extra keyword arguments passed to mapper initialization. |
{}
|
workflow_data
|
dict[Any, Any] | None
|
dict[Any, Any] global workflow data. |
None
|
user_agent_params
|
dict[str, Any] | None
|
dict[str, Any] params of user agent. |
required |
auth_middleware_manager
|
AuthMiddlewareManager | None
|
AuthMiddlewareManager instance of auth middleware manager. |
None
|
dispatcher
|
Dispatcher | None
|
Optional source of lifecycle listeners used during initialization. The dispatcher is not bound to this client. |
None
|
registration_config
|
RegistrationConfig | None
|
instance of RegistrationConfig for register account. |
required |
token_suffix
|
str
|
The token suffix value. |
'MaxApi'
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If transport or protocol or mapper cannot be None. |
Source code in src/pyromax/core/client.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 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 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 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 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
connect
async
¶
connect(**kwargs: Any) -> None
Source code in src/pyromax/core/client.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | |
get_available_app_versions
async
¶
get_available_app_versions() -> tuple[str, ...]
Load and return versions available in the configured catalog.
Source code in src/pyromax/core/client.py
492 493 494 495 496 497 498 | |
set_app_version
async
¶
set_app_version(
app_version: str, *, reconnect: bool = True
) -> str
Apply a catalog version and optionally reconnect the live mapper.
Source code in src/pyromax/core/client.py
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | |
set_random_app_version
async
¶
set_random_app_version(
*, reconnect: bool = True, exclude: tuple[str, ...] = ()
) -> str
Choose another catalog version at random and apply it.
Source code in src/pyromax/core/client.py
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |
request_shutdown ¶
request_shutdown() -> None
Request graceful shutdown without blocking the caller.
Source code in src/pyromax/core/client.py
550 551 552 553 554 555 556 557 558 559 | |
_add_disconnect_listener ¶
_add_disconnect_listener(
listener: Callable[
[DisconnectEvent, MaxApi], Awaitable[Any]
],
) -> None
Subscribe an internal listener to connection-loss notifications.
Source code in src/pyromax/core/client.py
561 562 563 564 565 566 567 | |
_remove_disconnect_listener ¶
_remove_disconnect_listener(
listener: Callable[
[DisconnectEvent, MaxApi], Awaitable[Any]
],
) -> None
Unsubscribe an internal connection-loss listener.
Source code in src/pyromax/core/client.py
569 570 571 572 573 574 575 | |
_add_unsupported_version_listener ¶
_add_unsupported_version_listener(
listener: Callable[
[UnsupportedClientVersionEvent, MaxApi],
Awaitable[Any],
],
) -> None
Subscribe an internal listener to unsupported-version events.
Source code in src/pyromax/core/client.py
577 578 579 580 581 582 583 584 585 | |
_remove_unsupported_version_listener ¶
_remove_unsupported_version_listener(
listener: Callable[
[UnsupportedClientVersionEvent, MaxApi],
Awaitable[Any],
],
) -> None
Unsubscribe an internal unsupported-version listener.
Source code in src/pyromax/core/client.py
587 588 589 590 591 592 593 594 595 | |
_load_dispatcher_lifecycle_listeners ¶
_load_dispatcher_lifecycle_listeners(
dispatcher: Dispatcher,
) -> None
Load reusable listeners without assigning dispatcher ownership.
Source code in src/pyromax/core/client.py
597 598 599 600 601 602 603 604 605 606 | |
_emit_disconnect
async
¶
_emit_disconnect(event: DisconnectEvent) -> None
Notify runtime listeners without allowing one to break reconnect.
Source code in src/pyromax/core/client.py
608 609 610 611 612 613 614 615 616 617 618 619 620 | |
_emit_unsupported_version
async
¶
_emit_unsupported_version(
event: UnsupportedClientVersionEvent,
) -> None
Notify runtime listeners without breaking version recovery.
Source code in src/pyromax/core/client.py
622 623 624 625 626 627 628 629 630 631 632 633 634 | |
wait_for_shutdown
async
¶
wait_for_shutdown() -> None
Wait until graceful shutdown is requested.
Source code in src/pyromax/core/client.py
641 642 643 | |
_shutdown_worker
async
¶
_shutdown_worker() -> None
Source code in src/pyromax/core/client.py
645 646 647 648 649 650 651 652 653 654 | |
_stop
async
¶
_stop() -> None
Source code in src/pyromax/core/client.py
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
stop
async
¶
stop() -> None
Stop the client once and wait for graceful shutdown to finish.
Source code in src/pyromax/core/client.py
717 718 719 720 721 722 | |
wait_until_ready
async
¶
wait_until_ready() -> bool
Wait until the client is ready or shutdown is requested.
Source code in src/pyromax/core/client.py
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | |
_update_session
async
¶
_update_session() -> None
Source code in src/pyromax/core/client.py
854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | |
__call__
async
¶
__call__(
class_of_method: type[BaseMaxApiMethod[Any]],
*args: Any,
**kwargs: Any
) -> Any
Invoke the max api.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
class_of_method
|
type[BaseMaxApiMethod[Any]]
|
MAX API method class to instantiate and execute. |
required |
args
|
Any
|
Positional arguments forwarded to the wrapped callable. |
()
|
kwargs
|
Any
|
Keyword arguments forwarded to the wrapped callable. |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
The value returned by the wrapped callable or backend. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If try a call method without connect state, because logger has not been initialized. |
Source code in src/pyromax/core/client.py
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | |
listen_updates ¶
listen_updates(
context: Any,
) -> tuple[
Callable[[Response], MaxObject],
AsyncGenerator[Response, None],
]
Yield incoming updates forever.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
Any
|
Runtime context passed to the mapper. |
required |
Returns:
| Type | Description |
|---|---|
tuple[Callable[[Response], MaxObject], AsyncGenerator[Response, None]]
|
Stream of incoming updates. |
Source code in src/pyromax/core/client.py
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | |
get_members_by_ids
async
¶
get_members_by_ids(
member_ids: list[int],
) -> Sequence[Contact]
Retrieve members by ids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
member_ids
|
list[int]
|
Identifiers of the members. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[Contact]
|
The Contacts collection. |
Source code in src/pyromax/core/CoreMixins/Contacts.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
get_member_by_id
async
¶
get_member_by_id(member_id: int) -> Contact | None
Retrieve member by id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
member_id
|
int
|
Identifier of the member. |
required |
Returns:
| Type | Description |
|---|---|
Contact | None
|
The resulting Contact | None. |
Source code in src/pyromax/core/CoreMixins/Contacts.py
42 43 44 45 46 47 48 49 50 51 | |
get_users
async
¶
get_users(user_ids: list[int]) -> list[Contact]
Retrieve users.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_ids
|
list[int]
|
Identifiers of the users. |
required |
Returns:
| Type | Description |
|---|---|
list[Contact]
|
The resulting collection. |
Source code in src/pyromax/core/CoreMixins/Contacts.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
get_user
async
¶
get_user(user_id: int) -> Contact | None
Retrieve user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
int
|
Identifier of the user. |
required |
Returns:
| Type | Description |
|---|---|
Contact | None
|
The resulting Contact | None. |
Source code in src/pyromax/core/CoreMixins/Contacts.py
71 72 73 74 75 76 77 78 79 80 | |
search_by_phone
async
¶
search_by_phone(phone: str) -> Contact
Search for by phone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phone
|
str
|
Phone number in the format accepted by MAX. |
required |
Returns:
| Type | Description |
|---|---|
Contact
|
The resulting Contact. |
Source code in src/pyromax/core/CoreMixins/Contacts.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
get_sessions
async
¶
get_sessions() -> list[Session]
Retrieve sessions.
Returns:
| Type | Description |
|---|---|
list[Session]
|
The Sessions collection. |
Source code in src/pyromax/core/CoreMixins/Contacts.py
100 101 102 103 104 105 106 107 | |
get_chat_id
async
¶
get_chat_id(first_user_id: int, second_user_id: int) -> int
Retrieve chat id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first_user_id
|
int
|
Identifier of the first user. |
required |
second_user_id
|
int
|
Identifier of the second user. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The resulting int value. |
Source code in src/pyromax/core/CoreMixins/Contacts.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
add_contact
async
¶
add_contact(contact_id: int) -> Contact
Add contact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contact_id
|
int
|
Identifier of the contact. |
required |
Returns:
| Type | Description |
|---|---|
Contact
|
The resulting Contact. |
Source code in src/pyromax/core/CoreMixins/Contacts.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
remove_contact
async
¶
remove_contact(contact_id: int) -> None
Remove contact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contact_id
|
int
|
Identifier of the contact. |
required |
Source code in src/pyromax/core/CoreMixins/Contacts.py
145 146 147 148 149 150 151 152 153 154 155 156 157 | |
import_contacts
async
¶
import_contacts(
contacts: list[ContactInfo],
) -> list[Contact]
Import contacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contacts
|
list[ContactInfo]
|
Collection of contacts. |
required |
Returns:
| Type | Description |
|---|---|
list[Contact]
|
The Contacts collection. |
Source code in src/pyromax/core/CoreMixins/Contacts.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
download_file
async
¶
download_file(
file: BaseFileAttachment,
) -> tuple[bytes, dict[str, str]] | tuple[None, None]
Download file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
BaseFileAttachment
|
File attachment to process. |
required |
Returns:
| Type | Description |
|---|---|
tuple[bytes, dict[str, str]] | tuple[None, None]
|
The resulting tuple[bytes, dict[str, str]] | tuple[None, None] value is request headers | None semantic. |
Source code in src/pyromax/core/CoreMixins/File.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
upload_file
async
¶
upload_file(
data: bytes | None,
typeof: type[BaseFileAttachment],
**kwargs: Any
) -> list[BaseFileAttachment | Any]
Upload file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
bytes | None
|
Contextual data passed through the processing pipeline. |
required |
typeof
|
type[BaseFileAttachment]
|
Attachment class that determines the upload type. |
required |
kwargs
|
Any
|
Keyword arguments forwarded to the wrapped callable. |
{}
|
Returns:
| Type | Description |
|---|---|
list[BaseFileAttachment | Any]
|
The resulting collection. |
Source code in src/pyromax/core/CoreMixins/File.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
change_profile
async
¶
change_profile(
first_name: str,
last_name: str | None = None,
description: str | None = None,
photo: bytes | None = None,
file_name: str | None = None,
photo_token: str | None = None,
) -> Profile
Change profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first_name
|
str
|
The first name. |
required |
last_name
|
str | None
|
The last name. |
None
|
description
|
str | None
|
The description. |
None
|
photo
|
bytes | None
|
The photo data. |
None
|
file_name
|
str | None
|
The file name or photo file. |
None
|
photo_token
|
str | None
|
The photo token value. |
None
|
Returns:
| Type | Description |
|---|---|
Profile
|
The resulting Profile. |
Source code in src/pyromax/core/CoreMixins/User.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
create_folder
async
¶
create_folder(
title: str,
chat_include: list[int],
filters: list[Any] | None = None,
folder_id: str | None = None,
) -> FolderUpdate
Create folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
The title of folder. |
required |
chat_include
|
list[int]
|
Collection of chat include. |
required |
filters
|
list[Any] | None
|
Collection of filters. |
None
|
folder_id
|
str | None
|
Identifier of the folder. |
None
|
Returns:
| Type | Description |
|---|---|
FolderUpdate
|
The resulting FolderUpdate. |
Source code in src/pyromax/core/CoreMixins/User.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
get_folders
async
¶
get_folders(folder_sync: int = 0) -> FolderList
Retrieve folders.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_sync
|
int
|
Synchronization marker. Leave as |
0
|
Returns:
| Type | Description |
|---|---|
FolderList
|
The resulting FolderList. |
Source code in src/pyromax/core/CoreMixins/User.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
update_folder
async
¶
update_folder(
folder_id: str,
title: str,
chat_include: list[int] | None = None,
filters: list[Any] | None = None,
options: list[Any] | None = None,
) -> FolderUpdate
Update folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_id
|
str
|
Identifier of the folder. |
required |
title
|
str
|
The title of folder. |
required |
chat_include
|
list[int] | None
|
Collection of chat include. |
None
|
filters
|
list[Any] | None
|
Collection of filters. |
None
|
options
|
list[Any] | None
|
Collection of options. |
None
|
Returns:
| Type | Description |
|---|---|
FolderUpdate
|
The resulting FolderUpdate. |
Source code in src/pyromax/core/CoreMixins/User.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
delete_folders
async
¶
delete_folders(folder_ids: list[str]) -> FolderUpdate
Delete folders.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_ids
|
list[str]
|
Identifiers of the folders. |
required |
Returns:
| Type | Description |
|---|---|
FolderUpdate
|
The resulting FolderUpdate. |
Source code in src/pyromax/core/CoreMixins/User.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
delete_folder
async
¶
delete_folder(folder_id: str) -> FolderUpdate
Delete folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_id
|
str
|
Identifier of the folder. |
required |
Returns:
| Type | Description |
|---|---|
FolderUpdate
|
The resulting FolderUpdate. |
Source code in src/pyromax/core/CoreMixins/User.py
171 172 173 174 175 176 177 178 179 | |
close_all_sessions
async
¶
close_all_sessions() -> bool
Close all sessions.
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/pyromax/core/CoreMixins/User.py
181 182 183 184 185 186 187 188 189 190 191 192 | |
logout
async
¶
logout() -> None
Logout.
Source code in src/pyromax/core/CoreMixins/User.py
194 195 196 | |
set_presence
async
¶
set_presence(online: bool) -> None
Set presence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
online
|
bool
|
The online value. |
required |
Source code in src/pyromax/core/CoreMixins/User.py
198 199 200 201 202 203 204 205 206 207 208 209 210 | |
change_profile_settings
async
¶
change_profile_settings(
privacy_settings: PrivacySettings,
) -> None
Update the account privacy settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
privacy_settings
|
PrivacySettings
|
Privacy settings to apply to the account. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If updating the privacy settings fails. |
Source code in src/pyromax/core/CoreMixins/User.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
create_group
async
¶
create_group(
title: str,
participant_ids: list[int] | None = None,
notify: bool = True,
chat_type: str = "CHAT",
event: str = "new",
typeof: str = "CONTROL",
) -> tuple[Chat, Message] | tuple[None, None]
Create group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
The title value. |
required |
participant_ids
|
list[int] | None
|
Identifiers of the participant objects. |
None
|
notify
|
bool
|
Whether MAX should notify affected users. |
True
|
chat_type
|
str
|
The chat type value. |
'CHAT'
|
event
|
str
|
Incoming event to process. |
'new'
|
typeof
|
str
|
Attachment class that determines the upload type. |
'CONTROL'
|
Returns:
| Type | Description |
|---|---|
tuple[Chat, Message] | tuple[None, None]
|
The resulting tuple[Chat, Message] | tuple[None, None] value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
36 37 38 39 40 41 42 43 44 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 72 73 74 | |
invite_users_to_group
async
¶
invite_users_to_group(
chat_id: int,
user_ids: list[int],
show_history: bool = True,
) -> Chat | None
Invite users to group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
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. |
Source code in src/pyromax/core/CoreMixins/Chat.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
remove_users_from_group
async
¶
remove_users_from_group(
chat_id: int,
user_ids: list[int] | list[str],
clean_msg_period: int,
) -> Chat | None
Remove users from group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
user_ids
|
list[int] | list[str]
|
Identifiers of the users. |
required |
clean_msg_period
|
int
|
Cleanup period for messages from removed participants. |
required |
Returns:
| Type | Description |
|---|---|
Chat | None
|
The resulting Chat | None value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
change_group_settings
async
¶
change_group_settings(
chat_id: int,
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
Change group settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
all_can_pin_message
|
bool | None
|
All participants can pin messages. |
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
|
Returns:
| Type | Description |
|---|---|
Chat | None
|
The resulting Chat | None value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
change_group_profile
async
¶
change_group_profile(
chat_id: int,
name: str | None = None,
description: str | None = None,
) -> Chat | None
Change group profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
name
|
str | None
|
The name of the chat. |
None
|
description
|
str | None
|
The description of the chat. |
None
|
Returns:
| Type | Description |
|---|---|
Chat | None
|
The resulting Chat | None value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
join_group
async
¶
join_group(link: str) -> Chat
Join group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link
|
str
|
Invite group link. |
required |
Returns:
| Type | Description |
|---|---|
Chat
|
The resulting Chat value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
200 201 202 203 204 205 206 207 208 209 210 211 212 | |
join_channel
async
¶
join_channel(link: str) -> Chat
Join channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link
|
str
|
Invite channel link. |
required |
Returns:
| Type | Description |
|---|---|
Chat
|
The resulting Chat value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
214 215 216 217 218 219 220 221 222 223 224 225 226 | |
resolve_group_by_link
async
¶
resolve_group_by_link(link: str) -> Chat | None
Resolve group by link.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link
|
str
|
Invite group link. |
required |
Returns:
| Type | Description |
|---|---|
Chat | None
|
The resulting Chat | None value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
228 229 230 231 232 233 234 235 236 237 238 239 240 | |
revoke_invite_link
async
¶
revoke_invite_link(chat_id: int) -> Chat
Revoke invite link.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
Returns:
| Type | Description |
|---|---|
Chat
|
The resulting Chat value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
242 243 244 245 246 247 248 249 250 251 252 253 254 | |
get_chats
async
¶
get_chats(chat_ids: Iterable[int]) -> list[Chat]
Retrieve chats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_ids
|
Iterable[int]
|
Identifiers of the chats. |
required |
Returns:
| Type | Description |
|---|---|
list[Chat]
|
The collection from gotten chats. |
Source code in src/pyromax/core/CoreMixins/Chat.py
256 257 258 259 260 261 262 263 264 265 266 267 268 | |
get_chat
async
¶
get_chat(chat_id: int) -> Chat
Retrieve chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
Returns:
| Type | Description |
|---|---|
Chat
|
The resulting Chat value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If chat not found. |
Source code in src/pyromax/core/CoreMixins/Chat.py
270 271 272 273 274 275 276 277 278 279 280 281 282 | |
leave_group
async
¶
leave_group(chat_id: int) -> Message | None
Leave group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
Returns:
| Type | Description |
|---|---|
Message | None
|
The resulting Message | None value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
leave_channel
async
¶
leave_channel(chat_id: int) -> Message | None
Leave channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
Returns:
| Type | Description |
|---|---|
Message | None
|
The resulting Message | None value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
fetch_chats
async
¶
fetch_chats(marker: int | None = None) -> list[Chat]
Fetch chats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
marker
|
int | None
|
Pagination marker in milliseconds. If |
None
|
Returns:
| Type | Description |
|---|---|
list[Chat]
|
The resulting Chats collection. |
Source code in src/pyromax/core/CoreMixins/Chat.py
318 319 320 321 322 323 324 325 326 327 328 329 330 | |
get_join_requests
async
¶
get_join_requests(
chat_id: int, count: int = 100
) -> list[Member]
Retrieve join requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
count
|
int
|
Maximum number of items to retrieve. |
100
|
Returns:
| Type | Description |
|---|---|
list[Member]
|
The resulting Members collection. |
Source code in src/pyromax/core/CoreMixins/Chat.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
confirm_join_requests
async
¶
confirm_join_requests(
chat_id: int,
user_ids: Iterable[int],
show_history: bool = True,
) -> Chat | None
Confirm join requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
user_ids
|
Iterable[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. |
Source code in src/pyromax/core/CoreMixins/Chat.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
confirm_join_request
async
¶
confirm_join_request(
chat_id: int, user_id: int, show_history: bool = True
) -> Chat | None
Confirm join request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
user_id
|
int
|
Identifier of the user. |
required |
show_history
|
bool
|
Show message history to new members. |
True
|
Returns:
| Type | Description |
|---|---|
Chat | None
|
The resulting Chat | None value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
decline_join_requests
async
¶
decline_join_requests(
chat_id: int, user_ids: Iterable[int]
) -> Chat | None
Decline join requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
user_ids
|
Iterable[int]
|
Identifiers of the users. |
required |
Returns:
| Type | Description |
|---|---|
Chat | None
|
The resulting Chat | None value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | |
decline_join_request
async
¶
decline_join_request(
chat_id: int, user_id: int
) -> Chat | None
Decline join request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
user_id
|
int
|
Identifier of the user. |
required |
Returns:
| Type | Description |
|---|---|
Chat | None
|
The resulting Chat | None value. |
Source code in src/pyromax/core/CoreMixins/Chat.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | |
delete_chat
async
¶
delete_chat(
chat_id: int,
last_event_time: int | None = None,
for_all: bool = True,
) -> None
Delete chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
last_event_time
|
int | None
|
The last event time value. |
None
|
for_all
|
bool
|
Delete only for the current account. |
True
|
Source code in src/pyromax/core/CoreMixins/Chat.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | |
add_admin
async
¶
add_admin(
chat_id: int,
user_id: int,
permissions: Iterable[ChannelPermissions],
) -> None
Add admin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
user_id
|
int
|
Identifier of the user. |
required |
permissions
|
Iterable[ChannelPermissions]
|
Collection of permissions. |
required |
Source code in src/pyromax/core/CoreMixins/Chat.py
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | |
set_channel_comments
async
¶
set_channel_comments(chat_id: int, enabled: bool) -> None
Enable or disable comments in a channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Channel identifier. |
required |
enabled
|
bool
|
Whether comments should be enabled. |
required |
Source code in src/pyromax/core/CoreMixins/Chat.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 | |
block_comment_author
async
¶
block_comment_author(
chat_id: int,
post_id: int,
user_ids: list[int],
message_id: int | str,
clean_msg_period: int = 0,
) -> bool
Block comment authors and optionally remove their comments.
Source code in src/pyromax/core/CoreMixins/Chat.py
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | |
send_message
async
¶
send_message(
chat_id: int,
text: str = "",
attaches: list[BaseFileAttachment] | None = None,
link: MessageLink | None = None,
notify: bool = True,
send_at: datetime | timedelta | int | None = None,
) -> Message | None
Send a message to a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Target chat identifier. |
required |
text
|
str
|
Message text. |
''
|
attaches
|
list[BaseFileAttachment] | None
|
Optional list of attachments. |
None
|
link
|
MessageLink | None
|
Optional message link object. |
None
|
notify
|
bool
|
Whether MAX should notify affected users. |
True
|
send_at
|
datetime | timedelta | int | None
|
Scheduled send time as an absolute datetime, a relative timedelta, or Unix time in seconds. None and 0 send immediately. |
None
|
Returns:
| Type | Description |
|---|---|
Message | None
|
API response returned by the mapper. |
Raises:
| Type | Description |
|---|---|
SendMessageError
|
If message sending fails. |
AttributeError
|
If logger not initialized in MaxApi instance. |
Source code in src/pyromax/core/CoreMixins/Message.py
49 50 51 52 53 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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
forward_message
async
¶
forward_message(
message_id: int | str,
to_chat_id: int,
from_chat_id: int,
notify: bool = True,
) -> Message | None
Forward message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message_id
|
int | str
|
Identifier of the message. |
required |
to_chat_id
|
int
|
Identifier of the destination chat. |
required |
from_chat_id
|
int
|
Identifier of the source chat. |
required |
notify
|
bool
|
Whether MAX should notify affected users. |
True
|
Returns:
| Type | Description |
|---|---|
Message | None
|
The resulting Message | None value. |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If logger not initialized in MaxApi instance. |
Source code in src/pyromax/core/CoreMixins/Message.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
edit_message
async
¶
edit_message(
chat_id: int,
message_id: int | str,
text: str | None = None,
attaches: list[BaseFileAttachment] | None = None,
**kwargs: Any
) -> Message
Edit message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
message_id
|
int | str
|
Identifier of the message. |
required |
text
|
str | None
|
Message or textual content. |
None
|
attaches
|
list[BaseFileAttachment] | None
|
Attachments associated with the message. |
None
|
Returns:
| Type | Description |
|---|---|
Message
|
The resulting Message value. |
Source code in src/pyromax/core/CoreMixins/Message.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
get_messages
async
¶
get_messages(
chat_id: int, message_ids: Iterable[str] | Iterable[int]
) -> list[Message]
Retrieve messages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
message_ids
|
Iterable[str] | Iterable[int]
|
Identifiers of the messages. |
required |
Returns:
| Type | Description |
|---|---|
list[Message]
|
The resulting collection. |
Source code in src/pyromax/core/CoreMixins/Message.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
get_message
async
¶
get_message(
chat_id: int, message_id: int | str
) -> Message | None
Retrieve message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
message_id
|
int | str
|
Identifier of the message. |
required |
Returns:
| Type | Description |
|---|---|
Message | None
|
The resulting Message | None value. |
Source code in src/pyromax/core/CoreMixins/Message.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
get_chat_history
async
¶
get_chat_history(
chat_id: int,
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]
get_chat_history(
chat_id: int,
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]
get_chat_history(
chat_id: int,
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]
get_chat_history(
chat_id: int,
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]
get_chat_history(
chat_id: int,
forward: int = ...,
backward: int = ...,
backward_time: int = ...,
forward_time: int = ...,
from_time: int | 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]
)
get_chat_history(
chat_id: int,
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 |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
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/core/CoreMixins/Message.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 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 | |
delete_messages
async
¶
delete_messages(
chat_id: int,
message_ids: list[str] | list[int],
for_me: bool = False,
) -> None
Delete messages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
message_ids
|
list[str] | list[int]
|
Identifiers of the messages. |
required |
for_me
|
bool
|
Delete only for the current account. |
False
|
Source code in src/pyromax/core/CoreMixins/Message.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |
pin_message
async
¶
pin_message(
chat_id: int, message_id: int | str, notify: bool = True
) -> None
Pin message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
message_id
|
int | str
|
Identifier of the message. |
required |
notify
|
bool
|
Whether MAX should notify affected users. |
True
|
Source code in src/pyromax/core/CoreMixins/Message.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
add_reaction
async
¶
add_reaction(
chat_id: int,
message_id: int | str,
reaction_id: str,
reaction_type: str = "EMOJI",
) -> EmojiReaction | None
Add an emoji reaction to a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat containing the message. |
required |
message_id
|
int | str
|
int | str |
required |
reaction_id
|
str
|
str |
required |
reaction_type
|
str
|
str |
'EMOJI'
|
Returns:
| Type | Description |
|---|---|
EmojiReaction | None
|
info about reaction or None if cannot get this info |
Raises:
| Type | Description |
|---|---|
ReactionError
|
if adding reaction failed |
Source code in src/pyromax/core/CoreMixins/Message.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | |
remove_reaction
async
¶
remove_reaction(
chat_id: int, message_id: int | str
) -> EmojiReaction | None
Remove reaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
message_id
|
int | str
|
Identifier of the message. |
required |
Returns:
| Type | Description |
|---|---|
EmojiReaction | None
|
The resulting EmojiReaction | None value. |
Source code in src/pyromax/core/CoreMixins/Message.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
get_reactions
async
¶
get_reactions(
chat_id: int, message_ids: list[str] | list[int]
) -> dict[str, EmojiReaction] | None
Retrieve reactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
message_ids
|
list[str] | list[int]
|
Identifiers of the messages. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, EmojiReaction] | None
|
The resulting dict[ |
Source code in src/pyromax/core/CoreMixins/Message.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
read_message
async
¶
read_message(
chat_id: int,
message_id: int | str,
typeof: str = "READ_MESSAGE",
mark: int | None = None,
) -> ReadState
Read message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
message_id
|
int | str
|
Identifier of the message. |
required |
typeof
|
str
|
Attachment class that determines the upload type. |
'READ_MESSAGE'
|
mark
|
int | None
|
The mark value. |
None
|
Returns:
| Type | Description |
|---|---|
ReadState
|
The resulting ReadState value. |
Source code in src/pyromax/core/CoreMixins/Message.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | |
create_poll
async
¶
create_poll(poll: Poll) -> Poll
Create poll.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
poll
|
Poll
|
Poll instance to process. |
required |
Returns:
| Type | Description |
|---|---|
Poll
|
The resulting Poll value what can be send with message in send_message method. |
Source code in src/pyromax/core/CoreMixins/Message.py
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | |
vote_poll
async
¶
vote_poll(
chat_id: int,
message_id: int | str,
poll_id: int,
answer_ids: list[int],
) -> PollState
Submit a vote for poll.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Identifier of the chat. |
required |
message_id
|
int | str
|
Identifier of the message. |
required |
poll_id
|
int
|
Identifier of the poll. |
required |
answer_ids
|
list[int]
|
Identifiers of the answer objects. |
required |
Returns:
| Type | Description |
|---|---|
PollState
|
The resulting PollState value. |
Source code in src/pyromax/core/CoreMixins/Message.py
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | |
send_comment
async
¶
send_comment(
chat_id: int,
post_id: int,
text: str | None = None,
reply_to: int | str | None = None,
attachments: list[BaseFileAttachment] | None = None,
*,
notify: bool = True
) -> Message | None
Send a comment to a channel post.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
int
|
Channel identifier. |
required |
post_id
|
int
|
Identifier of the channel post. |
required |
text
|
str | None
|
Comment text with supported formatting tags. |
None
|
reply_to
|
int | str | None
|
Optional comment identifier to reply to. |
None
|
attachments
|
list[BaseFileAttachment] | None
|
Optional comment attachments. |
None
|
notify
|
bool
|
Whether MAX should notify affected users. |
True
|
Returns:
| Type | Description |
|---|---|
Message | None
|
The created comment, or |
Source code in src/pyromax/core/CoreMixins/Message.py
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
fetch_comments
async
¶
fetch_comments(
chat_id: int,
post_id: int,
from_: int | None = ...,
backward: int = ...,
get_messages: Literal[True] = True,
forward: int = ...,
get_chat: Literal[False] = False,
) -> list[Message]
fetch_comments(
chat_id: int,
post_id: int,
from_: int | None = ...,
backward: int = ...,
get_messages: Literal[True] = True,
forward: int = ...,
get_chat: Literal[True] = True,
) -> tuple[list[Message], Chat | None]
fetch_comments(
chat_id: int,
post_id: int,
from_: int | None = ...,
backward: int = ...,
get_messages: Literal[False] = False,
forward: int = ...,
get_chat: Literal[False] = False,
) -> list[int | str]
fetch_comments(
chat_id: int,
post_id: int,
from_: int | None = ...,
backward: int = ...,
get_messages: Literal[False] = False,
forward: int = ...,
get_chat: Literal[True] = True,
) -> tuple[list[int | str], Chat | None]
fetch_comments(
chat_id: int,
post_id: int,
from_: int | None = ...,
backward: int = ...,
get_messages: bool = ...,
forward: int = ...,
get_chat: bool = ...,
) -> (
list[Message]
| list[int | str]
| tuple[list[Message] | list[int | str], Chat | None]
)
fetch_comments(
chat_id: int,
post_id: int,
from_: int | None = None,
backward: int = 30,
get_messages: bool = True,
forward: int = 0,
get_chat: bool = False,
) -> (
list[Message]
| list[int | str]
| tuple[list[Message] | list[int | str], Chat | None]
)
Fetch comments for a channel post.
Source code in src/pyromax/core/CoreMixins/Message.py
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | |
edit_comment
async
¶
edit_comment(
chat_id: int,
post_id: int,
message_id: int | str,
text: str | None = None,
attachments: list[BaseFileAttachment] | None = None,
) -> Message
Edit a comment on a channel post.
Source code in src/pyromax/core/CoreMixins/Message.py
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |
get_comments
async
¶
get_comments(
chat_id: int, post_id: int, message_ids: list[int | str]
) -> list[Message]
Get specific comments from a channel post.
Source code in src/pyromax/core/CoreMixins/Message.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | |
get_comment
async
¶
get_comment(
chat_id: int, post_id: int, message_id: int | str
) -> Message | None
Get one comment from a channel post.
Source code in src/pyromax/core/CoreMixins/Message.py
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | |
delete_comment
async
¶
delete_comment(
chat_id: int,
post_id: int,
message_ids: list[int] | list[str],
for_me: bool = False,
) -> bool
Delete comments from a channel post.
Source code in src/pyromax/core/CoreMixins/Message.py
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | |
add_comment_reaction
async
¶
add_comment_reaction(
chat_id: int,
post_id: int,
message_id: int | str,
reaction: str,
) -> EmojiReaction | None
Add or replace the current account's reaction to a comment.
Source code in src/pyromax/core/CoreMixins/Message.py
771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | |
remove_comment_reaction
async
¶
remove_comment_reaction(
chat_id: int, post_id: int, message_id: int | str
) -> EmojiReaction | None
Remove the current account's reaction from a comment.
Source code in src/pyromax/core/CoreMixins/Message.py
790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | |
subscribe_comments
async
¶
subscribe_comments(
chat_id: int, post_id: int, subscribe: bool = True
) -> None
Subscribe to or unsubscribe from a post's comment events.
Source code in src/pyromax/core/CoreMixins/Message.py
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 | |
get_comments_info
async
¶
get_comments_info(
chat_id: int, post_ids: list[int]
) -> list[CommentsInfoUpdate]
Get comment counters for channel posts.
Source code in src/pyromax/core/CoreMixins/Message.py
824 825 826 827 828 829 830 831 832 833 834 835 836 837 | |
delete_user_comments
async
¶
delete_user_comments(
chat_id: int,
post_id: int,
user_id: int,
message_id: int | str,
) -> bool
Delete a user's comments through the dedicated server operation.
Source code in src/pyromax/core/CoreMixins/Message.py
839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 | |
set_2fa
async
¶
set_2fa(
password: str,
email: str | None = None,
hint: str | None = None,
email_code_getter: (
Callable[[str], Coroutine[Any, Any, str]] | None
) = None,
two_factor_actions: list[TwoFactorAction] | None = None,
) -> None
Set 2fa.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
password
|
str
|
New 2FA password. |
required |
email
|
str | None
|
Email address for 2FA, if required. |
None
|
hint
|
str | None
|
Password hint, if required. |
None
|
email_code_getter
|
Callable[[str], Coroutine[Any, Any, str]] | None
|
Callable to get password, first argument is phone number. |
None
|
two_factor_actions
|
list[TwoFactorAction] | None
|
Collection of two factor actions. |
None
|
Source code in src/pyromax/core/CoreMixins/Auth.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
remove_2fa
async
¶
remove_2fa(
password: str,
two_factor_actions: list[TwoFactorAction] | None = None,
remove_2fa: bool = True,
) -> None
Remove 2fa.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
password
|
str
|
Account password. |
required |
two_factor_actions
|
list[TwoFactorAction] | None
|
Collection of two factor actions. |
None
|
remove_2fa
|
bool
|
The remove 2fa value. |
True
|
Source code in src/pyromax/core/CoreMixins/Auth.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
change_password
async
¶
change_password(
password_old: str,
password_new: str,
hint: str | None = None,
two_factor_actions: list[TwoFactorAction] | None = None,
) -> None
Change password.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
password_old
|
str
|
The password old value. |
required |
password_new
|
str
|
The password new value. |
required |
hint
|
str | None
|
Password hint. |
None
|
two_factor_actions
|
list[TwoFactorAction] | None
|
Collection of two factor actions. |
None
|
Source code in src/pyromax/core/CoreMixins/Auth.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
check_2fa
async
¶
check_2fa() -> bool
Check 2fa.
Returns:
| Type | Description |
|---|---|
bool
|
True when the account has 2FA; otherwise False. |
Source code in src/pyromax/core/CoreMixins/Auth.py
105 106 107 108 109 110 111 112 113 114 115 116 | |
approve_qr_login
async
¶
approve_qr_login(qr_link: str) -> None
Approve qr login.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qr_link
|
str
|
Link to the authorization QR code. |
required |
Source code in src/pyromax/core/CoreMixins/Auth.py
118 119 120 121 122 123 124 125 126 127 128 129 130 | |