Skip to content

Types

Lightweight dataclasses used as parameter and return types throughout the library. File, Image, Audio, and Video describe local media you want to upload; Reaction represents an emoji reaction event.

from matrix.types import Image

avatar = Image(
    path="/tmp/avatar.png",
    filename="avatar.png",
    mimetype="image/png",
    height=128,
    width=128,
)
await ctx.room.send_image(avatar)

matrix.types.File dataclass

File(path, filename, mimetype)

path instance-attribute

path

filename instance-attribute

filename

mimetype instance-attribute

mimetype

matrix.types.Image dataclass

Image(path, filename, mimetype, height, width)

Bases: File

height instance-attribute

height

width instance-attribute

width

matrix.types.Audio dataclass

Audio(path, filename, mimetype, duration=0)

Bases: File

duration class-attribute instance-attribute

duration = 0

matrix.types.Video dataclass

Video(
    path, filename, mimetype, width=0, height=0, duration=0
)

Bases: File

width class-attribute instance-attribute

width = 0

height class-attribute instance-attribute

height = 0

duration class-attribute instance-attribute

duration = 0

matrix.types.Reaction dataclass

Reaction(key, senders)

key instance-attribute

key

senders instance-attribute

senders