Kotlin coroutine

This commit is contained in:
Him188moe 2019-09-24 22:57:59 +08:00
parent f459891cf8
commit d315dcbc71

View File

@ -19,13 +19,13 @@ import javax.imageio.ImageIO
/**
* 不确定是否存在于服务器的 [Image].
* 必须在发送之前 [UnsolvedImage.upload] [Contact.uploadImage], 否则会发送失败.
x *
*
* @suppress todo 重新设计
* @author Him188moe
*/
class UnsolvedImage(filename: String, val image: BufferedImage) : Image(getImageId(filename)) {
constructor(imageFile: File) : this(imageFile.name, ImageIO.read(imageFile))
constructor(url: URL) : this(File(url.file))
fun upload(session: LoginSession, contact: Contact): CompletableFuture<Unit> {
return session.expectPacket<ServerTryGetImageIDResponsePacket> {
toSend { ClientTryGetImageIDPacket(session.bot.account.qqNumber, session.sessionKey, contact.number, image) }