Skip to main content

Message

Class swibots.api.chat.models.User

The Message class represents a message sent to a chat.

Properties

  • id (int): The message's id.
  • user_id (int): The message's sender's id.
  • user (User): The message's sender.
  • receiver_id (int): The message's receiver's id.
  • receiver (User): The message's receiver.
  • message (str): The message's text.
  • sent_date (int): The message's sent date.
  • status (int): The message's status.
  • request_id (int): The message's request id.
  • channel_chat (bool): Whether the message is a channel chat.
  • channel_id (int): The message's channel's id.
  • channel (Channel): The message's channel.
  • community_id (int): The message's community's id.
  • community (Community): The message's community.
  • edit (bool): Whether the message is an edit.
  • flag (int): The message's flag.
  • forward (bool): Whether the message is a forward.
  • group_chat (bool): Whether the message is a group chat.
  • group_id (int): The message's group's id.
  • group (Group): The message's group.
  • information (str): The message's information.
  • inline_markup (InlineMarkup): The message's inline markup.
  • is_read (bool): Whether the message is read.
  • is_media (bool): Whether message includes media.
  • is_embed_message (bool): Whether message includes embedded.
  • embed_message: (EmbeddedMedia): The embedded message.
  • media_link (str): The message's media link.
  • replied_message (str): The message's replied message.
  • replied_to_id (int): The message's replied to id.
  • replied_to (Message): The message's replied to.
  • replies (Message): The message's replies.
  • reply_count (int): The message's reply count.
  • personal_chat (bool): Whether the message is a personal chat.
  • pinned (bool): Whether the message is pinned.
  • reactions (List[str]): The message's reactions.
  • media_id (int): The message's media id. (for media messages)
  • media_info (Media): The message's media. (for media messages)
  • cached_media (Media): When sending a message, you can use this to send media that has already been uploaded to the server. (for media messages)

Api Methods

Unlike other types, the Message class has a few api methods to make it easier to work with.

  • ***async def respond(self, text: str, embed_message: EmbeddedMedia = None, inline_markup: InlineMarkup) -> Message ***

    Sends the message.

    You can also add media.

  • ***async def reply(self, text: str, embed_message: EmbeddedMedia = None) -> Message ***

    Replies to the message with the given message.

    You can also add media.

  • ***async def reply_text(self, text: str, inline_markup: Optional[InlineMarkup] = None, media: MediaUploadRequest = None) -> Message ***

    Replies to the message with the given text.

    You can also add an inline markup and media.

  • ***async edit_text(self, text: str, inline_markup: Optional[InlineMarkup] = None) -> Message ***

    Edits the message's text.

    You can also add an inline markup.

  • ***async def delete(self) -> None ***

    Deletes the message.

  • async def download(self, file_name: str = None, in_memory: bool = False, block: bool = True, progress: Callable = None, progress_args: tuple = ()) -> Optional[Union[BinaryIO, bytes]]:

    Downloads the message's media (Please refer to Downloading media).