mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 18:00:33 +08:00
Kotlin coroutine
This commit is contained in:
parent
f459891cf8
commit
d315dcbc71
@ -19,13 +19,13 @@ import javax.imageio.ImageIO
|
|||||||
/**
|
/**
|
||||||
* 不确定是否存在于服务器的 [Image].
|
* 不确定是否存在于服务器的 [Image].
|
||||||
* 必须在发送之前 [UnsolvedImage.upload] 或 [Contact.uploadImage], 否则会发送失败.
|
* 必须在发送之前 [UnsolvedImage.upload] 或 [Contact.uploadImage], 否则会发送失败.
|
||||||
x *
|
*
|
||||||
|
* @suppress todo 重新设计
|
||||||
* @author Him188moe
|
* @author Him188moe
|
||||||
*/
|
*/
|
||||||
class UnsolvedImage(filename: String, val image: BufferedImage) : Image(getImageId(filename)) {
|
class UnsolvedImage(filename: String, val image: BufferedImage) : Image(getImageId(filename)) {
|
||||||
constructor(imageFile: File) : this(imageFile.name, ImageIO.read(imageFile))
|
constructor(imageFile: File) : this(imageFile.name, ImageIO.read(imageFile))
|
||||||
constructor(url: URL) : this(File(url.file))
|
constructor(url: URL) : this(File(url.file))
|
||||||
|
|
||||||
fun upload(session: LoginSession, contact: Contact): CompletableFuture<Unit> {
|
fun upload(session: LoginSession, contact: Contact): CompletableFuture<Unit> {
|
||||||
return session.expectPacket<ServerTryGetImageIDResponsePacket> {
|
return session.expectPacket<ServerTryGetImageIDResponsePacket> {
|
||||||
toSend { ClientTryGetImageIDPacket(session.bot.account.qqNumber, session.sessionKey, contact.number, image) }
|
toSend { ClientTryGetImageIDPacket(session.bot.account.qqNumber, session.sessionKey, contact.number, image) }
|
||||||
|
Loading…
Reference in New Issue
Block a user