mirai-core / net.mamoe.mirai.message / MessagePacket

MessagePacket

abstract class MessagePacket<TSender : User, TSubject : Contact> : MessagePacketBase<TSender, TSubject>
Deprecated: use ContactMessage

一条从服务器接收到的消息事件. 请查看各平台的 actual 实现的说明.

Constructors

<init>

一条从服务器接收到的消息事件. 请查看各平台的 actual 实现的说明.

MessagePacket()

Functions

downloadAndClose

下载图片到 output 并关闭这个 output

suspend fun Image.downloadAndClose(output: OutputStream): Unit
suspend fun Image.downloadAndClose(output: Output): Unit
suspend fun Image.downloadAndClose(output: ByteWriteChannel): Unit

downloadTo

suspend fun Image.downloadTo(file: File): Unit

下载图片到 output 但不关闭这个 output

suspend fun Image.downloadTo(output: OutputStream): Unit
suspend fun Image.downloadTo(output: Output): Unit
suspend fun Image.downloadTo(output: ByteWriteChannel): Unit

send

suspend fun BufferedImage.send(): MessageReceipt<TSubject>

sendAsImage

suspend fun URL.sendAsImage(): MessageReceipt<TSubject>
suspend fun Input.sendAsImage(): MessageReceipt<TSubject>
suspend fun InputStream.sendAsImage(): MessageReceipt<TSubject>
suspend fun File.sendAsImage(): MessageReceipt<TSubject>

sendImage

suspend fun sendImage(image: BufferedImage): MessageReceipt<TSubject>
suspend fun sendImage(image: URL): MessageReceipt<TSubject>
suspend fun sendImage(image: Input): MessageReceipt<TSubject>
suspend fun sendImage(image: InputStream): MessageReceipt<TSubject>
suspend fun sendImage(image: File): MessageReceipt<TSubject>

upload

suspend fun BufferedImage.upload(): Image

uploadAsImage

suspend fun URL.uploadAsImage(): Image
suspend fun Input.uploadAsImage(): Image
suspend fun InputStream.uploadAsImage(): Image
suspend fun File.uploadAsImage(): Image

uploadImage

suspend fun uploadImage(image: BufferedImage): Image
suspend fun uploadImage(image: URL): Image
suspend fun uploadImage(image: Input): Image
suspend fun uploadImage(image: InputStream): Image
suspend fun uploadImage(image: File): Image

Extension Functions

broadcast

广播一个事件的唯一途径.

suspend fun <E : Event> E.broadcast(): E

isContextIdenticalWith

fun MessagePacket<*, *>.isContextIdenticalWith(another: MessagePacket<*, *>): Boolean

Inheritors

ContactMessage

一条消息事件. 它是一个 BotEvent, 因此可以被 监听

abstract class ContactMessage : MessagePacket<User, Contact>, BotEvent