mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 01:30:17 +08:00
Http api refactor uploadImage
This commit is contained in:
parent
e698f69e5a
commit
460170f6b4
@ -28,7 +28,6 @@ import net.mamoe.mirai.api.http.data.common.MessageChainDTO
|
|||||||
import net.mamoe.mirai.api.http.data.common.VerifyDTO
|
import net.mamoe.mirai.api.http.data.common.VerifyDTO
|
||||||
import net.mamoe.mirai.api.http.data.common.toMessageChain
|
import net.mamoe.mirai.api.http.data.common.toMessageChain
|
||||||
import net.mamoe.mirai.api.http.util.toJson
|
import net.mamoe.mirai.api.http.util.toJson
|
||||||
import net.mamoe.mirai.contact.toList
|
|
||||||
import net.mamoe.mirai.message.data.MessageChain
|
import net.mamoe.mirai.message.data.MessageChain
|
||||||
import net.mamoe.mirai.message.uploadImage
|
import net.mamoe.mirai.message.uploadImage
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
@ -90,8 +89,8 @@ fun Application.messageModule() {
|
|||||||
parts.file("img")?.apply {
|
parts.file("img")?.apply {
|
||||||
val image = streamProvider().use {
|
val image = streamProvider().use {
|
||||||
when (type) {
|
when (type) {
|
||||||
"group" -> session.bot.groups.toList().random().uploadImage(it)
|
"group" -> session.bot.groups.firstOrNull()?.uploadImage(it)
|
||||||
"friend" -> session.bot.qqs.toList().random().uploadImage(it)
|
"friend" -> session.bot.qqs.firstOrNull()?.uploadImage(it)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user