Skip to content

Comment methods API

SendCommentMethod

Bases: BaseMaxApiMethod[Message | None]

__call__ async

__call__(
    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.

Source code in src/pyromax/methods/SendComment.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
async def __call__(
    self,
    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."""
    if not self._max_api:
        raise RuntimeError("SendComment method not bound to MaxApi instance")

    return cast(
        Message | None,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            text=text,
            reply_to=reply_to,
            attachments=attachments,
            notify=notify,
        ),
    )

FetchCommentsMethod

Bases: BaseMaxApiMethod[FetchCommentsResult]

__call__ async

__call__(
    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]
__call__(
    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]
__call__(
    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]
__call__(
    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]
__call__(
    chat_id: int,
    post_id: int,
    from_: int | None = ...,
    backward: int = ...,
    get_messages: bool = ...,
    forward: int = ...,
    get_chat: bool = ...,
) -> FetchCommentsResult
__call__(
    chat_id: int,
    post_id: int,
    from_: int | None = None,
    backward: int = 30,
    get_messages: bool = True,
    forward: int = 0,
    get_chat: bool = False,
) -> FetchCommentsResult

Fetch comments for a channel post.

Source code in src/pyromax/methods/FetchComments.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
async def __call__(
    self,
    chat_id: int,
    post_id: int,
    from_: int | None = None,
    backward: int = 30,
    get_messages: bool = True,
    forward: int = 0,
    get_chat: bool = False,
) -> FetchCommentsResult:
    """Fetch comments for a channel post."""
    if not self._max_api:
        raise RuntimeError("FetchComments method not bound to MaxApi instance")

    return cast(
        FetchCommentsResult,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            from_=from_,
            backward=backward,
            get_messages=get_messages,
            forward=forward,
            get_chat=get_chat,
        ),
    )

GetCommentMethod

Bases: BaseMaxApiMethod[Message | None]

__call__ async

__call__(
    chat_id: int, post_id: int, message_id: int | str
) -> Message | None

Get one comment from a channel post.

Source code in src/pyromax/methods/GetComment.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async def __call__(
    self,
    chat_id: int,
    post_id: int,
    message_id: int | str,
) -> Message | None:
    """Get one comment from a channel post."""
    if not self._max_api:
        raise RuntimeError("GetComment method not bound to MaxApi instance")

    return cast(
        Message | None,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            message_id=message_id,
        ),
    )

GetCommentsMethod

Bases: BaseMaxApiMethod[list[Message]]

__call__ async

__call__(
    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/methods/GetComments.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async def __call__(
    self,
    chat_id: int,
    post_id: int,
    message_ids: list[int | str],
) -> list[Message]:
    """Get specific comments from a channel post."""
    if not self._max_api:
        raise RuntimeError("GetComments method not bound to MaxApi instance")

    return cast(
        list[Message],
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            message_ids=message_ids,
        ),
    )

EditCommentMethod

Bases: BaseMaxApiMethod[Message]

__call__ async

__call__(
    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/methods/EditComment.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
async def __call__(
    self,
    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."""
    if not self._max_api:
        raise RuntimeError("EditComment method not bound to MaxApi instance")

    return cast(
        Message,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            message_id=message_id,
            text=text,
            attachments=attachments,
        ),
    )

DeleteCommentMethod

Bases: BaseMaxApiMethod[bool]

__call__ async

__call__(
    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/methods/DeleteComment.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
async def __call__(
    self,
    chat_id: int,
    post_id: int,
    message_ids: list[int] | list[str],
    for_me: bool = False,
) -> bool:
    """Delete comments from a channel post."""
    if not self._max_api:
        raise RuntimeError("DeleteComment method not bound to MaxApi instance")

    return cast(
        bool,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            message_ids=message_ids,
            for_me=for_me,
        ),
    )

AddCommentReactionMethod

Bases: BaseMaxApiMethod[EmojiReaction | None]

__call__ async

__call__(
    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/methods/AddCommentReaction.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
async def __call__(
    self,
    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."""
    if not self._max_api:
        raise RuntimeError("AddCommentReaction method not bound to MaxApi instance")

    return cast(
        EmojiReaction | None,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            message_id=message_id,
            reaction=reaction,
        ),
    )

RemoveCommentReactionMethod

Bases: BaseMaxApiMethod[EmojiReaction | None]

__call__ async

__call__(
    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/methods/RemoveCommentReaction.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
async def __call__(
    self,
    chat_id: int,
    post_id: int,
    message_id: int | str,
) -> EmojiReaction | None:
    """Remove the current account's reaction from a comment."""
    if not self._max_api:
        raise RuntimeError(
            "RemoveCommentReaction method not bound to MaxApi instance"
        )

    return cast(
        EmojiReaction | None,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            message_id=message_id,
        ),
    )

SubscribeCommentsMethod

Bases: BaseMaxApiMethod[None]

__call__ async

__call__(
    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/methods/SubscribeComments.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
async def __call__(
    self,
    chat_id: int,
    post_id: int,
    subscribe: bool = True,
) -> None:
    """Subscribe to or unsubscribe from a post's comment events."""
    if not self._max_api:
        raise RuntimeError("SubscribeComments method not bound to MaxApi instance")

    return cast(
        None,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            subscribe=subscribe,
        ),
    )

GetCommentsInfoMethod

Bases: BaseMaxApiMethod[list[CommentsInfoUpdate]]

__call__ async

__call__(
    chat_id: int, post_ids: list[int]
) -> list[CommentsInfoUpdate]

Get comment counters for channel posts.

Source code in src/pyromax/methods/GetCommentsInfo.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
async def __call__(
    self,
    chat_id: int,
    post_ids: list[int],
) -> list[CommentsInfoUpdate]:
    """Get comment counters for channel posts."""
    if not self._max_api:
        raise RuntimeError("GetCommentsInfo method not bound to MaxApi instance")

    return cast(
        list[CommentsInfoUpdate],
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_ids=post_ids,
        ),
    )

DeleteUserCommentsMethod

Bases: BaseMaxApiMethod[bool]

__call__ async

__call__(
    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/methods/DeleteUserComments.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
async def __call__(
    self,
    chat_id: int,
    post_id: int,
    user_id: int,
    message_id: int | str,
) -> bool:
    """Delete a user's comments through the dedicated server operation."""
    if not self._max_api:
        raise RuntimeError("DeleteUserComments method not bound to MaxApi instance")

    return cast(
        bool,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            user_id=user_id,
            message_id=message_id,
        ),
    )

SetChannelCommentsMethod

Bases: BaseMaxApiMethod[None]

__call__ async

__call__(chat_id: int, enabled: bool) -> None

Enable or disable comments in a channel.

Source code in src/pyromax/methods/SetChannelComments.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
async def __call__(self, chat_id: int, enabled: bool) -> None:
    """Enable or disable comments in a channel."""
    if not self._max_api:
        raise RuntimeError("SetChannelComments method not bound to MaxApi instance")

    return cast(
        None,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            enabled=enabled,
        ),
    )

BlockCommentAuthorMethod

Bases: BaseMaxApiMethod[bool]

__call__ async

__call__(
    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/methods/BlockCommentAuthor.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
async def __call__(
    self,
    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."""
    if not self._max_api:
        raise RuntimeError("BlockCommentAuthor method not bound to MaxApi instance")

    return cast(
        bool,
        await self._max_api.mapper.call_method(
            type(self),
            chat_id=chat_id,
            post_id=post_id,
            user_ids=user_ids,
            message_id=message_id,
            clean_msg_period=clean_msg_period,
        ),
    )