mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 02:20:14 +08:00
group active data
This commit is contained in:
parent
cae3251291
commit
69d5bbd7fa
@ -10,12 +10,9 @@
|
|||||||
package net.mamoe.mirai.qqandroid
|
package net.mamoe.mirai.qqandroid
|
||||||
|
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
|
import io.ktor.client.request.*
|
||||||
import io.ktor.client.request.forms.MultiPartFormDataContent
|
import io.ktor.client.request.forms.MultiPartFormDataContent
|
||||||
import io.ktor.client.request.forms.formData
|
import io.ktor.client.request.forms.formData
|
||||||
import io.ktor.client.request.get
|
|
||||||
import io.ktor.client.request.headers
|
|
||||||
import io.ktor.client.request.post
|
|
||||||
import io.ktor.client.request.url
|
|
||||||
import io.ktor.client.statement.HttpResponse
|
import io.ktor.client.statement.HttpResponse
|
||||||
import kotlinx.coroutines.CoroutineName
|
import kotlinx.coroutines.CoroutineName
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
@ -319,7 +316,7 @@ internal abstract class QQAndroidBotBase constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(LowLevelAPI::class)
|
@LowLevelAPI
|
||||||
@MiraiExperimentalAPI
|
@MiraiExperimentalAPI
|
||||||
override suspend fun _lowLevelGetAnnouncement(groupId: Long, fid: String): GroupAnnouncement {
|
override suspend fun _lowLevelGetAnnouncement(groupId: Long, fid: String): GroupAnnouncement {
|
||||||
val data = network.async {
|
val data = network.async {
|
||||||
@ -345,6 +342,26 @@ internal abstract class QQAndroidBotBase constructor(
|
|||||||
return json.parse(GroupAnnouncement.serializer(), rep)
|
return json.parse(GroupAnnouncement.serializer(), rep)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@LowLevelAPI
|
||||||
|
@MiraiExperimentalAPI
|
||||||
|
override suspend fun _lowLevelGetGroupActiveData(groupId: Long): GroupActiveData {
|
||||||
|
val data = network.async {
|
||||||
|
HttpClient().get<String> {
|
||||||
|
url("https://qqweb.qq.com/c/activedata/get_mygroup_data")
|
||||||
|
parameter("bkn",bkn)
|
||||||
|
parameter("gc",groupId)
|
||||||
|
|
||||||
|
headers {
|
||||||
|
append(
|
||||||
|
"cookie",
|
||||||
|
"uin=o${selfQQ.id}; skey=${client.wLoginSigInfo.sKey.data.encodeToString()}; p_uin=o${selfQQ.id};"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val rep = data.await()
|
||||||
|
return json.parse(GroupActiveData.serializer(), rep)
|
||||||
|
}
|
||||||
|
|
||||||
override suspend fun queryImageUrl(image: Image): String = when (image) {
|
override suspend fun queryImageUrl(image: Image): String = when (image) {
|
||||||
is OnlineFriendImageImpl -> image.originUrl
|
is OnlineFriendImageImpl -> image.originUrl
|
||||||
|
@ -0,0 +1,135 @@
|
|||||||
|
package net.mamoe.mirai.data
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 群统计信息
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class GroupActiveData(
|
||||||
|
|
||||||
|
@SerialName("ec")
|
||||||
|
val ec: Int? = null,
|
||||||
|
|
||||||
|
@SerialName("em")
|
||||||
|
val msg: String?,
|
||||||
|
|
||||||
|
@SerialName("errcode")
|
||||||
|
val errCode: Int?,
|
||||||
|
|
||||||
|
@SerialName("ginfo")
|
||||||
|
val info: Ginfo? = null,
|
||||||
|
|
||||||
|
@SerialName("role")
|
||||||
|
val role: Int?
|
||||||
|
) {
|
||||||
|
@Serializable
|
||||||
|
data class Ginfo(
|
||||||
|
|
||||||
|
|
||||||
|
@SerialName("g_act_num")
|
||||||
|
val actNum: List<GActNum?>?, //发言人数列表
|
||||||
|
|
||||||
|
@SerialName("g_createtime")
|
||||||
|
val createTime: Int?,
|
||||||
|
|
||||||
|
@SerialName("g_exit_num")
|
||||||
|
val exitNum: List<GExitNum?>?, //退群人数列表
|
||||||
|
|
||||||
|
@SerialName("g_join_num")
|
||||||
|
val joinNum: List<GJoinNum?>?,
|
||||||
|
|
||||||
|
@SerialName("g_mem_num")
|
||||||
|
val memNum: List<GMemNum?>?, //人数变化
|
||||||
|
|
||||||
|
@SerialName("g_most_act")
|
||||||
|
val mostAct: List<GMostAct?>?, //发言排行
|
||||||
|
|
||||||
|
@SerialName("g_sentences")
|
||||||
|
val sentences: List<GSentence?>?,
|
||||||
|
|
||||||
|
@SerialName("gc")
|
||||||
|
val gc: Int?,
|
||||||
|
|
||||||
|
@SerialName("gn")
|
||||||
|
val gn: String?,
|
||||||
|
|
||||||
|
@SerialName("gowner")
|
||||||
|
val gowner: String?,
|
||||||
|
|
||||||
|
@SerialName("isEnd")
|
||||||
|
val isEnd: Int?
|
||||||
|
) {
|
||||||
|
@Serializable
|
||||||
|
data class GActNum(
|
||||||
|
|
||||||
|
@SerialName("date")
|
||||||
|
val date: String?,
|
||||||
|
|
||||||
|
@SerialName("num")
|
||||||
|
val num: Int?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class GExitNum(
|
||||||
|
|
||||||
|
@SerialName("date")
|
||||||
|
val date: String?,
|
||||||
|
|
||||||
|
@SerialName("num")
|
||||||
|
val num: Int?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class GJoinNum(
|
||||||
|
|
||||||
|
@SerialName("date")
|
||||||
|
val date: String?,
|
||||||
|
|
||||||
|
@SerialName("num")
|
||||||
|
val num: Int?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class GMemNum(
|
||||||
|
|
||||||
|
@SerialName("date")
|
||||||
|
val date: String?,
|
||||||
|
|
||||||
|
@SerialName("num")
|
||||||
|
val num: Int?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class GMostAct(
|
||||||
|
|
||||||
|
@SerialName("name")
|
||||||
|
val name: String?, // 名称 不完整
|
||||||
|
|
||||||
|
@SerialName("sentences_num")
|
||||||
|
val sentencesNum: Int?, // 发言数
|
||||||
|
|
||||||
|
@SerialName("sta")
|
||||||
|
val sta: Int?,
|
||||||
|
|
||||||
|
@SerialName("uin")
|
||||||
|
val uin: Long?
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class GSentence(
|
||||||
|
|
||||||
|
@SerialName("date")
|
||||||
|
val date: String?,
|
||||||
|
|
||||||
|
@SerialName("num")
|
||||||
|
val num: Int?
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -132,6 +132,14 @@ interface LowLevelBotAPIAccessor {
|
|||||||
@MiraiExperimentalAPI
|
@MiraiExperimentalAPI
|
||||||
suspend fun _lowLevelGetAnnouncement(groupId: Long, fid: String): GroupAnnouncement
|
suspend fun _lowLevelGetAnnouncement(groupId: Long, fid: String): GroupAnnouncement
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取群活跃信息
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
@LowLevelAPI
|
||||||
|
@MiraiExperimentalAPI
|
||||||
|
suspend fun _lowLevelGetGroupActiveData(groupId: Long): GroupActiveData
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user