Skip to content

Models

Message

Message

Bases: BaseMaxObject

message_id instance-attribute

message_id: int | str

chat_id instance-attribute

chat_id: int

time instance-attribute

time: int

type instance-attribute

type: str | None

sender_id class-attribute instance-attribute

sender_id: int | None = None

status class-attribute instance-attribute

status: Literal[
    "EDITED", "REPLY", "USER", "REMOVED", "SHARE", "OTHER"
] = "USER"

text instance-attribute

text: str | None

cid instance-attribute

cid: int | None

elements class-attribute instance-attribute

elements: list[dict[str, Any]] | None = None
link: MessageLink | None = None

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
async def answer(
    self,
    text: str | None = None,
    attaches: list[BaseFileAttachment] | None = None,
    link: MessageLink | None = None,
) -> Any:
    """Answer.

    :param text: Message or textual content.
    :type text: str | None
    :param attaches: Attachments associated with the message.
    :type attaches: list[BaseFileAttachment] | None
    :param link: Invite, message, or resource link.
    :type link: MessageLink | None
    :returns: The value returned by the wrapped callable or backend.
    :rtype: Any
    """
    from ..methods import SendMessageMethod

    return await self.max_api(
        class_of_method=SendMessageMethod,
        text=text,
        chat_id=self.chat_id,
        attaches=attaches,
        link=link,
    )

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
async def reply(
    self,
    text: str | None = None,
    attaches: list[BaseFileAttachment] | None = None,
) -> Any:
    """Reply.

    :param text: Message or textual content.
    :type text: str | None
    :param attaches: Attachments associated with the message.
    :type attaches: list[BaseFileAttachment] | None
    :returns: The value returned by the wrapped callable or backend.
    :rtype: Any
    """
    link = MessageLink(
        type="REPLY",
        message_id=self.message_id,
    )

    return await self.answer(
        text=text,
        attaches=attaches,
        link=link,
    )

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
async def forward(
    self,
    chat_id: int,
    *,
    notify: bool = True,
) -> Message | None:
    """Forward.

    :param chat_id: Identifier of the chat.
    :type chat_id: int
    :param notify: Whether MAX should notify affected users.
    :type notify: bool
    :returns: The resulting Message | None value.
    :rtype: Message | None
    """
    return await self.max_api.forward_message(
        from_chat_id=self.chat_id,
        to_chat_id=chat_id,
        message_id=self.message_id,
        notify=notify,
    )

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
async def pin(self, notify_pin: bool = True) -> None:
    """Pin.

    :param notify_pin: Whether MAX should notify affected users.
    :type notify_pin: bool
    """
    return await self.max_api.pin_message(
        chat_id=self.chat_id,
        message_id=self.message_id,
        notify=notify_pin,
    )

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
async def edit(
    self,
    text: str | None = None,
    attachments: list[BaseFileAttachment] | None = None,
) -> Message:
    """Edit.

    :param text: Message or textual content.
    :type text: str | None
    :param attachments: Attachments associated with the message.
    :type attachments: list[BaseFileAttachment] | None
    :returns: The resulting Message value.
    :rtype: Message
    """
    return await self.max_api.edit_message(
        chat_id=self.chat_id,
        message_id=self.message_id,
        text=text,
        attachments=attachments,
    )

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
async def delete(self, for_me: bool = False) -> None:
    """Delete.

    :param for_me: Delete only for the current account.
    :type for_me: bool
    """
    return await self.max_api.delete_messages(
        chat_id=self.chat_id,
        message_ids=[self.message_id],
        for_me=for_me,
    )

read async

read() -> ReadState

Read.

Returns:

Type Description
ReadState

The resulting ReadState value.

Source code in src/pyromax/models/Message.py
173
174
175
176
177
178
179
180
181
182
async def read(self) -> ReadState:
    """Read.

    :returns: The resulting ReadState value.
    :rtype: ReadState
    """
    return await self.max_api.read_message(
        chat_id=self.chat_id,
        message_id=self.message_id,
    )

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
184
185
186
187
188
189
190
191
192
193
194
195
196
async def react(self, reaction: str) -> EmojiReaction | None:
    """React.

    :param reaction: The reaction value.
    :type reaction: str
    :returns: The resulting EmojiReaction | None value.
    :rtype: EmojiReaction | None
    """
    return await self.max_api.add_reaction(
        chat_id=self.chat_id,
        message_id=self.message_id,
        reaction_id=reaction,
    )

unreact async

unreact() -> EmojiReaction | None

Unreact.

Returns:

Type Description
EmojiReaction | None

The resulting EmojiReaction | None value.

Source code in src/pyromax/models/Message.py
198
199
200
201
202
203
204
205
206
207
async def unreact(self) -> EmojiReaction | None:
    """Unreact.

    :returns: The resulting EmojiReaction | None value.
    :rtype: EmojiReaction | None
    """
    return await self.max_api.remove_reaction(
        chat_id=self.chat_id,
        message_id=self.message_id,
    )

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
209
210
211
212
213
214
215
216
217
218
async def get_reactions(self) -> dict[str, EmojiReaction] | None:
    """Retrieve reactions.

    :returns: The resulting dict[str, EmojiReaction] | None value.
    :rtype: dict[str, EmojiReaction] | None
    """
    return await self.max_api.get_reactions(
        chat_id=self.chat_id,
        message_ids=[self.message_id],
    )

Chat

Chat

Bases: BaseMaxObject

id instance-attribute

id: int

type instance-attribute

type: Literal['DIALOG', 'CHAT', 'CHANNEL']

status instance-attribute

status: str

owner instance-attribute

owner: int

participants class-attribute instance-attribute

participants: dict[int, int] = Field(default_factory=dict)

title class-attribute instance-attribute

title: str | None = None

base_raw_icon_url class-attribute instance-attribute

base_raw_icon_url: str | None = None

base_icon_url class-attribute instance-attribute

base_icon_url: str | None = None

last_message class-attribute instance-attribute

last_message: Message | None = None

last_event_time class-attribute instance-attribute

last_event_time: int = 0

last_delayed_update_time class-attribute instance-attribute

last_delayed_update_time: int = 0

last_fire_delayed_error_time class-attribute instance-attribute

last_fire_delayed_error_time: int = 0

created class-attribute instance-attribute

created: int = 0

new_messages class-attribute instance-attribute

new_messages: int = 0
link: str | None = None

access class-attribute instance-attribute

access: Literal["PUBLIC", "PRIVATE", "SECRET"] | None = None

restrictions class-attribute instance-attribute

restrictions: int | None = None

pinned_message class-attribute instance-attribute

pinned_message: Message | None = None

participants_count class-attribute instance-attribute

participants_count: int = 0

description class-attribute instance-attribute

description: str | None = None

options class-attribute instance-attribute

options: dict[str, bool] | int | None = None

join_time class-attribute instance-attribute

join_time: int = 0

invited_by class-attribute instance-attribute

invited_by: int | None = None

modified class-attribute instance-attribute

modified: int = 0

messages_count class-attribute instance-attribute

messages_count: int = 0

has_bots class-attribute instance-attribute

has_bots: bool | None = None

prev_message_id class-attribute instance-attribute

prev_message_id: int | None = None

admin_participants class-attribute instance-attribute

admin_participants: dict[int, dict[Any, Any]] = Field(
    default_factory=dict
)

admins class-attribute instance-attribute

admins: list[int] = Field(default_factory=list)

cid class-attribute instance-attribute

cid: int | None = None

is_dialog property

is_dialog: bool

Return whether dialog.

Returns:

Type Description
bool

True when the requested condition is satisfied; otherwise False.

is_group property

is_group: bool

Return whether group.

Returns:

Type Description
bool

True when the requested condition is satisfied; otherwise False.

is_channel property

is_channel: bool

Return whether channel.

Returns:

Type Description
bool

True when the requested condition is satisfied; otherwise False.

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
async def answer(
    self,
    text: str | None = None,
    link: MessageLink | None = None,
    attaches: list[BaseFileAttachment] | None = None,
    notify: bool = True,
) -> Message | None:
    """Answer.

    :param text: Message or textual content.
    :type text: str | None
    :param link: Message link to another message(s).
    :type link: MessageLink | None
    :param attaches: Attachments associated with the message.
    :type attaches: list[BaseFileAttachment] | None
    :param notify: Whether MAX should notify affected users.
    :type notify: bool
    :returns: The resulting Message | None value.
    :rtype: Message | None
    """
    return await self.max_api.send_message(
        chat_id=self.id,
        text=text,
        link=link,
        attaches=attaches,
        notify=notify,
    )

history async

history(
    forward: int = ...,
    backward: int = ...,
    backward_time: int = ...,
    forward_time: int = ...,
    from_time: int | None = ...,
    item_type: Literal["DELAYED", "REGULAR"] = ...,
    get_chat: bool = ...,
    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: bool = ...,
    get_messages: Literal[False] = False,
    interactive: bool = ...,
) -> list[str]
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]
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]

Retrieve chat history.

Parameters:

Name Type Description Default
forward int

How many messages to load ahead from from_time.

0
backward int

How many messages to load back from from_time.

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, the current moment is used.

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]

Message collection if get_messages is True else message ids collection.

Source code in src/pyromax/models/Chat.py
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
async def history(
    self,
    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]:

    """Retrieve chat history.

    :param forward: How many messages to load ahead from ``from_time``.
    :type forward: int
    :param backward: How many messages to load back from ``from_time``.
    :type backward: int
    :param backward_time: Look-back time window in milliseconds.
    :type backward_time: int
    :param forward_time: Forward time window in milliseconds.
    :type forward_time: int
    :param from_time: The reference point in Unix time (milliseconds). If ``None``, the current moment is used.
    :type from_time: int | None
    :param item_type: History item type.
    :type item_type: Literal['DELAYED', 'REGULAR']
    :param get_chat: Request chat data along with the history.
    :type get_chat: bool
    :param get_messages: The get messages value.
    :type get_messages: bool
    :param interactive: Request the messages themselves.
    :type interactive: bool
    :returns: Message collection if get_messages is True else message ids collection.
    :rtype: list[Message] | list[str]
    """

    return await self.max_api.get_chat_history(
        chat_id=self.id,
        forward=forward,
        backward=backward,
        backward_time=backward_time,
        forward_time=forward_time,
        from_time=from_time,
        item_type=item_type,
        get_chat=get_chat,
        interactive=interactive,
        get_messages=get_messages,
    )

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
237
238
239
240
241
242
243
244
245
246
247
248
async def get_message(self, message_id: int | str) -> Message | None:
    """Retrieve message.

    :param message_id: Identifier of the message.
    :type message_id: int | str
    :returns: The resulting Message | None value.
    :rtype: Message | None
    """
    return await self.max_api.get_message(
        chat_id=self.id,
        message_id=message_id,
    )

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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
async def get_messages(
    self, message_ids: Iterable[int] | Iterable[str]
) -> list[Message]:
    """Retrieve messages.

    :param message_ids: Identifiers of the messages.
    :type message_ids: Iterable[int] | Iterable[str]
    :returns: The resulting collection.
    :rtype: list[Message]
    """
    return await self.max_api.get_messages(
        chat_id=self.id,
        message_ids=message_ids,
    )

leave async

leave() -> None

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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
async def leave(self) -> None:
    """leave the chat

    :raises RuntimeError: if chat is DIALOG
    :raises ValueError: if chat type is unknown
    """

    if self.type == "DIALOG":
        raise RuntimeError("Cannot leave dialog")
    elif self.type == "CHAT":
        return await self.max_api.leave_group(
            chat_id=self.id,
        )
    elif self.type == "CHANNEL":
        return await self.max_api.leave_channel(
            chat_id=self.id,
        )
    raise ValueError("Unknown chat type=%s", self.type)

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
284
285
286
287
288
289
290
291
292
293
async def delete(self, for_all: bool = True) -> None:
    """Delete.

    :param for_all: Delete only for the current account.
    :type for_all: bool
    """
    return await self.max_api.delete_chat(
        chat_id=self.id,
        for_all=for_all,
    )

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
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
async def invite(
    self, user_ids: list[int], show_history: bool = True
) -> Chat | None:
    """invite users to chat

    :raises ValueError: if try to invite users to unknown chat
    :raises RuntimeError: if max_api not linked to chat instance

    :param user_ids: Identifiers of the users.
    :type user_ids: list[int]
    :param show_history: Show message history to new members.
    :type show_history: bool
    :returns: The resulting Chat | None value.
    :rtype: Chat | None
    """

    if self.type == "CHAT":
        return await self.max_api.invite_users_to_group(
            chat_id=self.id,
            user_ids=user_ids,
            show_history=show_history,
        )
    elif self.type == "CHANNEL":
        return await self.max_api.invite_users_to_group(
            chat_id=self.id,
            user_ids=user_ids,
            show_history=show_history,
        )

    raise ValueError("Unknown chat type=%s", self.type)

remove_users async

remove_users(
    user_ids: list[int], clean_msg_period: int = 0
) -> 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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
async def remove_users(
    self,
    user_ids: list[int],
    clean_msg_period: int = 0,
) -> None:
    """Remove users.

    :param user_ids: Identifiers of the users.
    :type user_ids: list[int]
    :param clean_msg_period: Cleanup period for messages from removed participants.
    :type clean_msg_period: int
    """
    return await self.max_api.remove_users_from_group(
        chat_id=self.id,
        user_ids=user_ids,
        clean_msg_period=clean_msg_period,
    )

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
344
345
346
347
348
349
350
351
352
353
354
355
356
async def pin_message(self, message_id: str | int, notify_pin: bool = True) -> None:
    """Pin message.

    :param message_id: Identifier of the message.
    :type message_id: str | int
    :param notify_pin: Whether MAX should notify affected users.
    :type notify_pin: bool
    """
    return await self.max_api.pin_message(
        chat_id=self.id,
        message_id=message_id,
        notify=notify_pin,
    )

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,
) -> 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
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
async def update_settings(
    self,
    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,
) -> None:
    """Update settings.

    :param all_can_pin_message: The all can pin message.
    :type all_can_pin_message: bool | None
    :param only_owner_can_change_icon_title: The only owner can change icon title.
    :type only_owner_can_change_icon_title: bool | None
    :param only_admin_can_add_member: The only admin can add member.
    :type only_admin_can_add_member: bool | None
    :param only_admin_can_call: The only admin can call.
    :type only_admin_can_call: bool | None
    :param members_can_see_private_link: The members can see private link.
    :type members_can_see_private_link: bool | None
    """
    return await self.max_api.change_group_settings(
        chat_id=self.id,
        all_can_pin_message=all_can_pin_message,
        only_admin_can_add_member=only_admin_can_add_member,
        only_admin_can_call=only_admin_can_call,
        members_can_see_private_link=members_can_see_private_link,
        only_owner_can_change_icon_title=only_owner_can_change_icon_title,
    )
revoke_invite_link() -> Chat

Revoke invite link.

Returns:

Type Description
Chat

The resulting Chat value.

Source code in src/pyromax/models/Chat.py
388
389
390
391
392
393
394
async def revoke_invite_link(self) -> Chat:
    """Revoke invite link.

    :returns: The resulting Chat value.
    :rtype: Chat
    """
    return await self.max_api.revoke_invite_link(chat_id=self.id)

Contact

Contact

Bases: BaseMaxObject

first_name class-attribute instance-attribute

first_name: str = ''

last_name class-attribute instance-attribute

last_name: str = ''

names class-attribute instance-attribute

names: list[Name] = Field(default_factory=list)

id instance-attribute

id: int

description class-attribute instance-attribute

description: str = ''

phone class-attribute instance-attribute

phone: str | None = None

avatar_url class-attribute instance-attribute

avatar_url: str | None = None

raw_avatar_url class-attribute instance-attribute

raw_avatar_url: str | None = None

photo_id class-attribute instance-attribute

photo_id: str | None = None

country class-attribute instance-attribute

country: str | None = None

account_status class-attribute instance-attribute

account_status: int | None = None

email class-attribute instance-attribute

email: str | None = None

registration_time class-attribute instance-attribute

registration_time: int | None = None

update_time class-attribute instance-attribute

update_time: int | None = None

status class-attribute instance-attribute

status: str | None = None

gender class-attribute instance-attribute

gender: str | int | None = None
link: str | None = None

web_app class-attribute instance-attribute

web_app: dict[str, Any] | str | None = None

menu_button class-attribute instance-attribute

menu_button: dict[str, Any] | None = None

options class-attribute instance-attribute

options: list[str] = Field(default_factory=list)

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
async def add_contact(self) -> "Contact":
    """Add contact.

    :returns: The resulting 'Contact' value.
    :rtype: 'Contact'
    """
    return await self.max_api.add_contact(
        contact_id=self.id,
    )

remove_contact async

remove_contact() -> None

Remove contact.

Source code in src/pyromax/models/Contact.py
42
43
44
45
46
47
async def remove_contact(self) -> None:
    """Remove contact.
    """
    return await self.max_api.remove_contact(
        contact_id=self.id,
    )

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
async def get_chat_id(self, contact_id: int) -> int:
    """Retrieve chat id.

    :param contact_id: Identifier of the contact.
    :type contact_id: int
    :returns: chat id.
    :rtype: int
    """
    return await self.max_api.get_chat_id(
        first_user_id=contact_id,
        second_user_id=self.id,
    )

ContactInfo

ContactInfo

Bases: BaseMaxObject

phone instance-attribute

phone: str

first_name instance-attribute

first_name: str

last_name class-attribute instance-attribute

last_name: str | None = None

Profile

Profile

Bases: BaseMaxObject

contact instance-attribute

contact: Contact

profile_options instance-attribute

profile_options: list[int] | None

Member

Member

Bases: BaseMaxObject

contact instance-attribute

contact: Contact

presence instance-attribute

presence: Presence

AuthFlow

AuthFlow

Bases: BaseMaxObject, Generic[M, P, T]

model_config class-attribute instance-attribute

model_config = ConfigDict(arbitrary_types_allowed=True)

token class-attribute instance-attribute

token: str | None = None

mapper instance-attribute

mapper: M

protocol instance-attribute

protocol: P

transport instance-attribute

transport: T

EmojiReaction

EmojiReaction

Counters

Bases: TypedDict

count instance-attribute

count: int

reaction instance-attribute

reaction: str

EmojiReaction

Bases: BaseMaxObject

chat_id instance-attribute

chat_id: int

message_id instance-attribute

message_id: str | int

counters instance-attribute

counters: list[Counters] | None

total_count instance-attribute

total_count: int | None

your_reaction instance-attribute

your_reaction: str | None

status class-attribute instance-attribute

status: Literal['ADD', 'REMOVE'] = 'ADD'

RegistrationConfig

RegistrationConfig

RegistrationConfig

Bases: BaseMaxObject

first_name instance-attribute

first_name: str

last_name class-attribute instance-attribute

last_name: str | None = None

Session

Session

Bases: BaseMaxObject

id class-attribute instance-attribute

id: int | str | None = None

device_id class-attribute instance-attribute

device_id: str | None = None

current class-attribute instance-attribute

current: bool | None = None

user_agent class-attribute instance-attribute

user_agent: str | None = None

app_version class-attribute instance-attribute

app_version: str | None = None

device_name class-attribute instance-attribute

device_name: str | None = None

device_type class-attribute instance-attribute

device_type: str | None = None

platform class-attribute instance-attribute

platform: str | None = None

ip class-attribute instance-attribute

ip: str | None = None

location class-attribute instance-attribute

location: str | None = None

created class-attribute instance-attribute

created: int | None = None

updated class-attribute instance-attribute

updated: int | None = None

last_activity class-attribute instance-attribute

last_activity: int | None = None

options class-attribute instance-attribute

options: dict[str, Any] | list[Any] | None = None

time class-attribute instance-attribute

time: int | None = None

info class-attribute instance-attribute

info: str | None = None

PrivacySettings

PrivacySettings

Bases: BaseMaxObject

search_by_phone class-attribute instance-attribute

search_by_phone: PrivacyAccess | None = None

incoming_calls class-attribute instance-attribute

incoming_calls: PrivacyAccess | None = None

chat_invites class-attribute instance-attribute

chat_invites: PrivacyAccess | None = None

phone_number_visibility class-attribute instance-attribute

phone_number_visibility: PrivacyAccess | None = None

hide_online_status class-attribute instance-attribute

hide_online_status: bool | None = None

safe_content_only class-attribute instance-attribute

safe_content_only: bool | None = None

Folder

Folder

Folder

Bases: BaseMaxObject

source_id class-attribute instance-attribute

source_id: int = 0

include class-attribute instance-attribute

include: list[int] = Field(default_factory=list)

options class-attribute instance-attribute

options: list[Any] = Field(default_factory=list)

update_time class-attribute instance-attribute

update_time: int = 0

id class-attribute instance-attribute

id: str = ''

filters class-attribute instance-attribute

filters: list[Any] = Field(default_factory=list)

title class-attribute instance-attribute

title: str = ''

FolderUpdate

Bases: BaseMaxObject

folders_order class-attribute instance-attribute

folders_order: list[str] = Field(default_factory=list)

folder class-attribute instance-attribute

folder: Folder | None = None

folder_sync class-attribute instance-attribute

folder_sync: int = 0

FolderList

Bases: BaseMaxObject

folders_order class-attribute instance-attribute

folders_order: list[str] = Field(default_factory=list)

folders class-attribute instance-attribute

folders: list[Folder] = Field(default_factory=list)

all_filter_exclude_folders class-attribute instance-attribute

all_filter_exclude_folders: list[Any] = Field(
    default_factory=list
)

folder_sync class-attribute instance-attribute

folder_sync: int = 0

ErrorEvent

ErrorEvent

ErrorEvent

Bases: BaseMaxObject

Received update

model_config class-attribute instance-attribute

model_config = ConfigDict(arbitrary_types_allowed=True)

update instance-attribute

update: BaseMaxObject | Response

exception instance-attribute

exception: Exception

Exception

Attachments

Attachments

BaseFileAttachment

Bases: BaseModel

VideoAttachment

VoiceAttachment

VideoNoteAttachment

PhotoAttachment

FileAttachment

ShareAttachment

ControlAttachment

Polls

Poll

NoneOrNever module-attribute

NoneOrNever = TypeVar('NoneOrNever', default=None)

default module-attribute

default = cast(int, None)

default_poll_state module-attribute

default_poll_state = cast(PollState, None)

PollVote

Bases: BaseMaxObject

timestamp instance-attribute

timestamp: int

user_id instance-attribute

user_id: int

PollResult

Bases: BaseMaxObject

answer_id instance-attribute

answer_id: int

vote_count instance-attribute

vote_count: int

votes instance-attribute

votes: list[PollVote]

rate instance-attribute

rate: int

options instance-attribute

options: int

PollState

Bases: BaseMaxObject

total class-attribute instance-attribute

total: int = 0

result class-attribute instance-attribute

result: list[PollResult] | None = None

voter_preview_ids instance-attribute

voter_preview_ids: list[int]

PollAnswer

Bases: BaseMaxObject, Generic[NoneOrNever]

text instance-attribute

text: str

answer_id class-attribute instance-attribute

answer_id: int | NoneOrNever = default

Poll

Bases: BaseFileAttachment, Generic[NoneOrNever]

title instance-attribute

title: str

answers instance-attribute

answers: list[PollAnswer[NoneOrNever]]

settings instance-attribute

settings: PollFlags

poll_id class-attribute instance-attribute

poll_id: int | NoneOrNever = default

version class-attribute instance-attribute

version: int | NoneOrNever = default

state class-attribute instance-attribute

state: PollState | NoneOrNever = default_poll_state