This commit is contained in:
ikechan8370 2023-11-28 17:10:19 +08:00
parent 80a4a208b9
commit c6dad5677c
3 changed files with 33 additions and 4 deletions

View File

@ -19,6 +19,7 @@ import moe.fuqiuluo.shamrock.remote.service.data.push.MessageTempSource
import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeEvent import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeEvent
import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeSubType import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeSubType
import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeType import moe.fuqiuluo.shamrock.remote.service.data.push.NoticeType
import moe.fuqiuluo.shamrock.remote.service.data.push.PokeDetail
import moe.fuqiuluo.shamrock.remote.service.data.push.PrivateFileMsg import moe.fuqiuluo.shamrock.remote.service.data.push.PrivateFileMsg
import moe.fuqiuluo.shamrock.remote.service.data.push.RequestEvent import moe.fuqiuluo.shamrock.remote.service.data.push.RequestEvent
import moe.fuqiuluo.shamrock.remote.service.data.push.RequestSubType import moe.fuqiuluo.shamrock.remote.service.data.push.RequestSubType
@ -221,7 +222,7 @@ internal object GlobalEventTransmitter: BaseSvc() {
* 群聊通知 通知器 * 群聊通知 通知器
*/ */
object GroupNoticeTransmitter { object GroupNoticeTransmitter {
suspend fun transGroupPoke(time: Long, operation: Long, target: Long, groupCode: Long): Boolean { suspend fun transGroupPoke(time: Long, operation: Long, target: Long, action: String?, suffix: String?, actionImg: String?, groupCode: Long): Boolean {
pushNotice(NoticeEvent( pushNotice(NoticeEvent(
time = time, time = time,
selfId = app.longAccountUin, selfId = app.longAccountUin,
@ -231,7 +232,12 @@ internal object GlobalEventTransmitter: BaseSvc() {
operatorId = operation, operatorId = operation,
userId = operation, userId = operation,
groupId = groupCode, groupId = groupCode,
target = target target = target,
pokeDetail = PokeDetail(
action = action,
suffix = suffix,
actionImg = actionImg
)
)) ))
return true return true
} }

View File

@ -76,9 +76,17 @@ internal data class NoticeEvent(
@SerialName("file") val file: GroupFileMsg? = null, @SerialName("file") val file: GroupFileMsg? = null,
@SerialName("private_file") val privateFile: PrivateFileMsg? = null, @SerialName("private_file") val privateFile: PrivateFileMsg? = null,
@SerialName("flag") val flag: String? = null, @SerialName("flag") val flag: String? = null,
// 群名片
@SerialName("card_new") val cardNew: String? = null, @SerialName("card_new") val cardNew: String? = null,
@SerialName("card_old") val cardOld: String? = null, @SerialName("card_old") val cardOld: String? = null,
// 群头衔
@SerialName("title") val title: String? = null, @SerialName("title") val title: String? = null,
// 戳一戳
@SerialName("poke_detail") val pokeDetail: PokeDetail? = null,
) )
/** /**
@ -115,4 +123,12 @@ internal data class PrivateFileMsg(
@SerialName("sub_id") val subId: String, @SerialName("sub_id") val subId: String,
val url: String, val url: String,
val expire: Long, val expire: Long,
)
@Serializable
internal data class PokeDetail (
val action: String? = "戳了戳",
val suffix: String? = "",
@SerialName("action_img_url")
val actionImg: String? = "https://tianquan.gtimg.cn/nudgeaction/item/0/expression.jpg",
) )

View File

@ -243,6 +243,9 @@ internal object PrimitiveListener {
lateinit var target: String lateinit var target: String
lateinit var operation: String lateinit var operation: String
var action: String? = null
var suffix: String? = null
var actionImg: String? = null
detail[26][7] detail[26][7]
.asList .asList
.value .value
@ -251,12 +254,16 @@ internal object PrimitiveListener {
when(it[1].asUtf8String) { when(it[1].asUtf8String) {
"uin_str1" -> operation = value "uin_str1" -> operation = value
"uin_str2" -> target = value "uin_str2" -> target = value
"action_str" -> action = value
"alt_str1" -> action = value
"suffix_str" -> suffix = value
"action_img_url" -> actionImg = value
} }
} }
LogCenter.log("群戳一戳($groupCode): $operation -> $target") LogCenter.log("群戳一戳($groupCode): $operation $action $target $suffix")
if(!GlobalEventTransmitter.GroupNoticeTransmitter if(!GlobalEventTransmitter.GroupNoticeTransmitter
.transGroupPoke(time, operation.toLong(), target.toLong(), groupCode)) { .transGroupPoke(time, operation.toLong(), target.toLong(), action, suffix, actionImg, groupCode)) {
LogCenter.log("群戳一戳推送失败!", Level.WARN) LogCenter.log("群戳一戳推送失败!", Level.WARN)
} }
} }