Module graia.application.message.elements.external

Expand source code
from typing import Optional
from . import ExternalElement


class Image(ExternalElement):
    type: str = "Image"
    imageId: Optional[str] = None
    url: Optional[str] = None
    path: Optional[str] = None

    def asSerializationString(self) -> str:
        return f"[mirai:image:{self.imageId}]"


class FlashImage(Image, ExternalElement):
    type = "FlashImage"

    def asSerializationString(self) -> str:
        return f"[mirai:flash:{self.imageId}]"


class Voice(ExternalElement):
    type = "Voice"
    voiceId: Optional[str] = None
    url: Optional[str] = None
    path: Optional[str] = None

    def asSerializationString(self) -> str:
        return f"[mirai:voice:{self.voiceId}]"

Classes

class FlashImage (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class FlashImage(Image, ExternalElement):
    type = "FlashImage"

    def asSerializationString(self) -> str:
        return f"[mirai:flash:{self.imageId}]"

Ancestors

Class variables

var imageId : Union[str, NoneType]
var path : Union[str, NoneType]
var type : str
var url : Union[str, NoneType]

Methods

def asSerializationString(self) ‑> str
Expand source code
def asSerializationString(self) -> str:
    return f"[mirai:flash:{self.imageId}]"
class Image (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Image(ExternalElement):
    type: str = "Image"
    imageId: Optional[str] = None
    url: Optional[str] = None
    path: Optional[str] = None

    def asSerializationString(self) -> str:
        return f"[mirai:image:{self.imageId}]"

Ancestors

Subclasses

Class variables

var imageId : Union[str, NoneType]
var path : Union[str, NoneType]
var type : str
var url : Union[str, NoneType]

Methods

def asSerializationString(self) ‑> str
Expand source code
def asSerializationString(self) -> str:
    return f"[mirai:image:{self.imageId}]"
class Voice (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Voice(ExternalElement):
    type = "Voice"
    voiceId: Optional[str] = None
    url: Optional[str] = None
    path: Optional[str] = None

    def asSerializationString(self) -> str:
        return f"[mirai:voice:{self.voiceId}]"

Ancestors

Class variables

var path : Union[str, NoneType]
var url : Union[str, NoneType]
var voiceId : Union[str, NoneType]

Methods

def asSerializationString(self) ‑> str
Expand source code
def asSerializationString(self) -> str:
    return f"[mirai:voice:{self.voiceId}]"