Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决getImage不能获取闪照的问题,遍历群成员的性能问题 #159

Merged
merged 3 commits into from
Apr 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/kotlin/org/itxtech/mirainative/bridge/MiraiBridge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ object MiraiBridge {
fun getImage(pluginId: Int, image: String): String =
call("CQ_getImage", pluginId, "", "Error occurred when plugin %0 downloading image $image") {
return@call runBlocking {
val img = image.replace(".mnimg", "")
val img = image.replace(".mnimg,type=flash","").replace(".mnimg", "") // fix when get flash image
val u = Image(img).queryUrl()
if (u != "") {
val response = client.get<HttpResponse>(u)
Expand Down Expand Up @@ -425,13 +425,13 @@ object MiraiBridge {
}

private suspend fun BytePacketBuilder.writeMember(member: NormalMember) {
val profile = member.queryProfile()
// val profile = member.queryProfile()
writeLong(member.group.id)
writeLong(member.id)
writeString(member.nick)
writeString(member.nameCard)
writeInt(profile.sex.ordinal)
writeInt(profile.age)
writeInt(0) // TODO: 性别
writeInt(0) // TODO: 年龄
writeString("未知") // TODO: 地区
writeInt(member.joinTimestamp)
writeInt(member.lastSpeakTimestamp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ object ChainCodeConverter {
}
is Audio -> "[CQ:record,file=${it.filename}.mnrec]"
is PokeMessage -> "[CQ:poke,id=${it.id},type=${it.pokeType},name=${it.name}]"
is FlashImage -> "[CQ:image,file=${it.image.imageId}.mning,type=flash]"
is FlashImage -> "[CQ:image,file=${it.image.imageId}.mnimg,type=flash]"
is MarketFace -> "[CQ:bface,id=${it.id},name=${it.name}]"
is Dice -> "[CQ:dice,type=${it.value}]"
else -> ""//error("不支持的消息类型:${it::class.simpleName}")
Expand Down