Image
自定义表情 (收藏的表情) 和普通图片.
最推荐的存储方式是存储图片原文件, 每次发送图片时都使用文件上传. 在上传时服务器会根据其缓存情况回复已有的图片 ID 或要求客户端上传. 详见 Contact.uploadImage
根据 ID 构造图片
Image.fromId. 在 Kotlin, 更推荐使用顶层函数
val image = Image("id")
上传和发送图片
Contact.uploadImage 上传 资源文件 并得到 Image 消息
Contact.sendImage 上传 资源文件 并发送返回的 Image 作为一条消息
下载图片
Image.queryUrl 扩展函数. 查询图片下载链接
IMirai.queryImageUrl 查询图片下载链接 (Java 使用)
mirai 码支持
格式: [mirai:image:Image.imageId]
See also
Types
AsStringSerializer
Link copied to clipboard
FallbackSerializer
Link copied to clipboard
Key
Link copied to clipboard
Serializer
Link copied to clipboard
Functions
appendMiraiCodeTo
Link copied to clipboard
contentEquals
Link copied to clipboard
open fun contentEquals(another: String, ignoreCase: Boolean = false): Boolean
Content copied to clipboard
判断内容是否与 another 相等.
open fun contentEquals(another: Message, ignoreCase: Boolean = false): Boolean
Content copied to clipboard
判断内容是否与 another 相等即 this
与 another 的 contentToString 相等.
open fun contentEquals(another: Message, ignoreCase: Boolean = false, strict: Boolean = false): Boolean
Content copied to clipboard
判断内容是否与 another 相等即 this
与 another 的 contentToString 相等. strict 为 true
时, 还会额外判断每个消息元素的类型, 顺序和属性. 如 Image 会判断 Image.imageId
contentToString
Link copied to clipboard
转为最接近官方格式的字符串. 如 At(member) + "test"
将转为 "@群名片 test"
.
followedBy
Link copied to clipboard
将 this
和 tail 连接.
serializeToMiraiCode
Link copied to clipboard
转换为 mirai 码.
Properties
Extensions
flash
Link copied to clipboard
将普通图片转换为闪照.
isUploaded
Link copied to clipboard
当图片在服务器上存在时返回 true
, 这意味着图片可以直接发送给 contact.
md5
Link copied to clipboard