mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-20 18:19:14 +08:00
Cleanup
This commit is contained in:
parent
1b4e1475a0
commit
83f721c59a
@ -569,8 +569,7 @@ internal abstract class QQAndroidBotBase constructor(
|
||||
val data = message.calculateValidationDataForGroup(
|
||||
sequenceId = sequenceId,
|
||||
random = Random.nextInt().absoluteValue.toUInt(),
|
||||
groupCode = groupCode,
|
||||
botMemberNameCard = group.botAsMember.nameCardOrNick
|
||||
groupCode = groupCode
|
||||
)
|
||||
|
||||
val response =
|
||||
|
@ -42,14 +42,15 @@ internal class MessageValidationData @OptIn(MiraiInternalAPI::class) constructor
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
internal inline fun Int.toLongUnsigned(): Long = this.toLong().and(0xFFFF_FFFF)
|
||||
|
||||
@OptIn(MiraiInternalAPI::class)
|
||||
internal fun Collection<ForwardMessage.INode>.calculateValidationDataForGroup(
|
||||
sequenceId: Int,
|
||||
random: UInt,
|
||||
groupCode: Long,
|
||||
botMemberNameCard: String
|
||||
random: Int,
|
||||
groupCode: Long
|
||||
): MessageValidationData {
|
||||
|
||||
val msgTransmit = MsgTransmit.PbMultiMsgTransmit(
|
||||
msg = this.map { chain ->
|
||||
MsgComm.Msg(
|
||||
@ -57,7 +58,7 @@ internal fun Collection<ForwardMessage.INode>.calculateValidationDataForGroup(
|
||||
fromUin = chain.senderId,
|
||||
msgSeq = sequenceId,
|
||||
msgTime = chain.time,
|
||||
msgUid = 0x01000000000000000L or random.toLong(),
|
||||
msgUid = 0x01000000000000000L or random.toLongUnsigned(),
|
||||
mutiltransHead = MsgComm.MutilTransHead(
|
||||
status = 0,
|
||||
msgId = 1
|
||||
|
@ -547,13 +547,12 @@ class ForwardMessageBuilder private constructor(
|
||||
/** 构造 [ForwardMessage] */
|
||||
fun build(): ForwardMessage = ForwardMessage(container.toList(), this.displayStrategy)
|
||||
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
private inline fun Int.toLongUnsigned(): Long = this.toLong().and(0xFFFF_FFFF)
|
||||
|
||||
@OptIn(MiraiExperimentalAPI::class)
|
||||
internal fun Bot.smartName(): String = when (val c = this@ForwardMessageBuilder.context) {
|
||||
is Group -> c.botAsMember.nameCardOrNick
|
||||
else -> nick
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
internal inline fun Int.toLongUnsigned(): Long = this.toLong().and(0xFFFF_FFFF)
|
||||
|
Loading…
Reference in New Issue
Block a user