应当如何发送图片? #864
Answered
by
StageGuard
AdorableParker
asked this question in
Q&A
应当如何发送图片?
#864
-
依据文档说明,似乎只需要将inputStream或是File类型的数据传给sendImage就可以了 |
Beta Was this translation helpful? Give feedback.
Answered by
StageGuard
Jan 16, 2021
Replies: 3 comments 15 replies
-
请提供版本号和报错内容以便于 |
Beta Was this translation helpful? Give feedback.
6 replies
-
参考: eventChannel.subscribeAlways<GroupMessageEvent> {
//① 将文件转为 ExternalResource,指定格式或不指定
group.sendImage(File("jpg_image_path").toExternalResource("jpg"))
//② 先上传图片,获得 Image
group.uploadImage(File("png_image_path").toExternalResource("png")).also {
// ② 和其他类型消息一起发送
group.sendMessage(buildMessageChain {
add(PlainText("plain"))
add(it)
})
// ② 直接发送
group.sendMessage(it)
}
//直接传入 File 和 图片格式
group.sendImage(File("img_path"), "bmp")
//直接传入 InputStream 和 图片格式
group.sendImage(File("file").inputStream(), "gif")
} |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
AdorableParker
-
java怎么发图片呀,能发下代码参考一下嘛,这个concat是什么东西,没看懂 - - |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参考: