mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 05:12:17 +00:00
Compare commits
2 Commits
1.0.8
...
b03e02675b
Author | SHA1 | Date | |
---|---|---|---|
b03e02675b | |||
e68a1ffd37 |
@ -1,5 +1,6 @@
|
||||
package moe.fuqiuluo.shamrock.remote.action.handlers
|
||||
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
@ -18,8 +19,10 @@ internal object GetGProChannelList: IActionHandler() {
|
||||
return invoke(guildId.toULong(), refresh, echo = session.echo)
|
||||
}
|
||||
|
||||
operator fun invoke(guildId: ULong, refresh: Boolean, echo: JsonElement = EmptyJsonString): String {
|
||||
val result = GProSvc.getChannelList(guildId, refresh)
|
||||
suspend operator fun invoke(guildId: ULong, refresh: Boolean, echo: JsonElement = EmptyJsonString): String {
|
||||
val result = withTimeoutOrNull(5000) {
|
||||
GProSvc.getChannelList(guildId, refresh)
|
||||
} ?: return error("timeout", echo)
|
||||
result.onFailure {
|
||||
return error(it.message ?: "unable to fetch channel list", echo)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.tencent.mobileqq.transfile.TransferRequest
|
||||
import com.tencent.mobileqq.transfile.api.ITransFileController
|
||||
import io.ktor.server.routing.Routing
|
||||
import io.ktor.server.routing.post
|
||||
import moe.fuqiuluo.shamrock.remote.service.config.ShamrockConfig
|
||||
import moe.fuqiuluo.shamrock.remote.structures.Status
|
||||
import moe.fuqiuluo.shamrock.tools.fetchPost
|
||||
import moe.fuqiuluo.shamrock.tools.respond
|
||||
@ -15,7 +16,7 @@ import kotlin.random.Random
|
||||
import kotlin.random.nextLong
|
||||
|
||||
fun Routing.registerBDH() {
|
||||
post("/upload_group_image") {
|
||||
if(ShamrockConfig.isDev()) post("/upload_group_image") {
|
||||
val troop = fetchPost("troop")
|
||||
val picBytes = Base64.decode(fetchPost("pic"), Base64.DEFAULT)
|
||||
val md5Str = MD5.getMd5Hex(picBytes)
|
||||
@ -46,5 +47,4 @@ fun Routing.registerBDH() {
|
||||
.transferAsync(transferRequest)
|
||||
respond(isOk = true, Status.Ok, "$md5Str.jpg")
|
||||
}
|
||||
|
||||
}
|
@ -174,8 +174,6 @@ internal object AioListener : IKernelMsgListener {
|
||||
|
||||
override fun onMsgInfoListUpdate(msgList: ArrayList<MsgRecord>?) {
|
||||
msgList?.forEach { record ->
|
||||
if (record.chatType == MsgConstant.KCHATTYPEGUILD) return@forEach// TODO: 频道消息暂不处理
|
||||
|
||||
if (record.sendStatus == MsgConstant.KSENDSTATUSFAILED
|
||||
|| record.sendStatus == MsgConstant.KSENDSTATUSSENDING
|
||||
) {
|
||||
|
Reference in New Issue
Block a user