Skip to content

Commit

Permalink
fix: SendPangu on TIM_NT
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Dec 22, 2024
1 parent e00af99 commit 79e2211
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/src/main/java/cc/microblock/hook/Pangu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ import io.github.qauxv.base.annotation.UiItemAgentEntry
import io.github.qauxv.dsl.FunctionEntryRouter
import io.github.qauxv.hook.CommonSwitchFunctionHook
import io.github.qauxv.util.QQVersion
import io.github.qauxv.util.TIMVersion
import io.github.qauxv.util.dexkit.AIOTextElementCtor
import io.github.qauxv.util.dexkit.DexKit
import io.github.qauxv.util.requireMinQQVersion
import io.github.qauxv.util.requireMinTimVersion
import xyz.nextalone.util.get
import xyz.nextalone.util.hookBefore
import xyz.nextalone.util.set
Expand Down Expand Up @@ -177,7 +179,11 @@ object SendPangu : CommonSwitchFunctionHook("sendMsgPangu", arrayOf(AIOTextEleme
override fun initOnce(): Boolean {
DexKit.requireMethodFromCache(AIOTextElementCtor)
.hookBefore(this) {
val inputStrFieldName = if (requireMinQQVersion(QQVersion.QQ_9_0_56)) "e" else "a"
val inputStrFieldName = when {
requireMinTimVersion(TIMVersion.TIM_4_0_95) -> "d"
requireMinQQVersion(QQVersion.QQ_9_0_56) -> "e"
else -> "a"
}
val content = it.args[0].get(inputStrFieldName) as String
if (!content.startsWith(",,") && !content.startsWith(",,"))
it.args[0].set(inputStrFieldName, processPangu(content))
Expand Down

0 comments on commit 79e2211

Please sign in to comment.