Commit 5dc0475a authored by Him188's avatar Him188

Misc improvements

parent 83793d3f
...@@ -39,11 +39,11 @@ import kotlin.coroutines.CoroutineContext ...@@ -39,11 +39,11 @@ import kotlin.coroutines.CoroutineContext
import kotlin.jvm.JvmSynthetic import kotlin.jvm.JvmSynthetic
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
internal fun GroupImpl.Companion.checkIsInstance(expression: Boolean) { internal fun GroupImpl.Companion.checkIsInstance(instance: Group) {
contract { contract {
returns() implies expression returns() implies (instance is GroupImpl)
} }
check(expression) { "group is not an instanceof GroupImpl!! DO NOT interlace two or more protocol implementations!!" } check(instance is GroupImpl) { "group is not an instanceof GroupImpl!! DO NOT interlace two or more protocol implementations!!" }
} }
@Suppress("PropertyName") @Suppress("PropertyName")
......
...@@ -197,7 +197,7 @@ internal class OnlinePush { ...@@ -197,7 +197,7 @@ internal class OnlinePush {
when (msgInfo.shMsgType.toInt()) { when (msgInfo.shMsgType.toInt()) {
732 -> { 732 -> {
val group = bot.getGroup(this.readUInt().toLong()) val group = bot.getGroup(this.readUInt().toLong())
GroupImpl.checkIsInstance(group is GroupImpl) GroupImpl.checkIsInstance(group)
when (val internalType = this.readByte().toInt().also { this.discardExact(1) }) { when (val internalType = this.readByte().toInt().also { this.discardExact(1) }) {
0x0c -> { // mute 0x0c -> { // mute
...@@ -215,7 +215,7 @@ internal class OnlinePush { ...@@ -215,7 +215,7 @@ internal class OnlinePush {
if (time == 0) { if (time == 0) {
return@flatMap sequenceOf( return@flatMap sequenceOf(
GroupMuteAllEvent( GroupMuteAllEvent(
origin = group.isMuteAll.also { group._muteAll = false }, origin = group.settings.isMuteAll.also { group._muteAll = false },
new = false, new = false,
operator = operator, operator = operator,
group = group group = group
...@@ -224,7 +224,7 @@ internal class OnlinePush { ...@@ -224,7 +224,7 @@ internal class OnlinePush {
} else { } else {
return@flatMap sequenceOf( return@flatMap sequenceOf(
GroupMuteAllEvent( GroupMuteAllEvent(
origin = group.isMuteAll.also { group._muteAll = true }, origin = group.settings.isMuteAll.also { group._muteAll = true },
new = true, new = true,
operator = operator, operator = operator,
group = group group = group
...@@ -283,7 +283,7 @@ internal class OnlinePush { ...@@ -283,7 +283,7 @@ internal class OnlinePush {
val switch = this.readInt() == 0 val switch = this.readInt() == 0
return@flatMap sequenceOf( return@flatMap sequenceOf(
GroupAllowAnonymousChatEvent( GroupAllowAnonymousChatEvent(
origin = group.isAnonymousChatEnabled.also { origin = group.settings.isAnonymousChatEnabled.also {
group._anonymousChat = switch group._anonymousChat = switch
}, },
new = switch, new = switch,
...@@ -312,7 +312,7 @@ internal class OnlinePush { ...@@ -312,7 +312,7 @@ internal class OnlinePush {
"管理员已关闭群聊坦白说" -> { "管理员已关闭群聊坦白说" -> {
return@flatMap sequenceOf( return@flatMap sequenceOf(
GroupAllowConfessTalkEvent( GroupAllowConfessTalkEvent(
origin = group.isConfessTalkEnabled.also { origin = group.settings.isConfessTalkEnabled.also {
group._confessTalk = false group._confessTalk = false
}, },
new = false, new = false,
...@@ -324,7 +324,7 @@ internal class OnlinePush { ...@@ -324,7 +324,7 @@ internal class OnlinePush {
"管理员已开启群聊坦白说" -> { "管理员已开启群聊坦白说" -> {
return@flatMap sequenceOf( return@flatMap sequenceOf(
GroupAllowConfessTalkEvent( GroupAllowConfessTalkEvent(
origin = group.isConfessTalkEnabled.also { origin = group.settings.isConfessTalkEnabled.also {
group._confessTalk = true group._confessTalk = true
}, },
new = true, new = true,
......
...@@ -3,14 +3,13 @@ package net.mamoe.mirai.data ...@@ -3,14 +3,13 @@ package net.mamoe.mirai.data
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import net.mamoe.mirai.utils.SinceMirai
/** /**
* 群统计信息 * 群统计信息
* */
* @SinceMirai("0.28.0")
* */
@Serializable @Serializable
data class GroupActiveData( data class GroupActiveData(
......
...@@ -97,7 +97,7 @@ interface LowLevelBotAPIAccessor { ...@@ -97,7 +97,7 @@ interface LowLevelBotAPIAccessor {
/** /**
* 获取群公告列表 * 获取群公告列表
* @param page 页码 * @param page 页码
* */ */
@SinceMirai("0.28.0") @SinceMirai("0.28.0")
@LowLevelAPI @LowLevelAPI
@MiraiExperimentalAPI @MiraiExperimentalAPI
...@@ -107,7 +107,7 @@ interface LowLevelBotAPIAccessor { ...@@ -107,7 +107,7 @@ interface LowLevelBotAPIAccessor {
* 发送群公告 * 发送群公告
* *
* @return 公告的fid * @return 公告的fid
* */ */
@SinceMirai("0.28.0") @SinceMirai("0.28.0")
@LowLevelAPI @LowLevelAPI
@MiraiExperimentalAPI @MiraiExperimentalAPI
...@@ -117,7 +117,7 @@ interface LowLevelBotAPIAccessor { ...@@ -117,7 +117,7 @@ interface LowLevelBotAPIAccessor {
/** /**
* 删除群公告 * 删除群公告
* @param fid [GroupAnnouncement.fid] * @param fid [GroupAnnouncement.fid]
* */ */
@SinceMirai("0.28.0") @SinceMirai("0.28.0")
@LowLevelAPI @LowLevelAPI
@MiraiExperimentalAPI @MiraiExperimentalAPI
...@@ -126,7 +126,7 @@ interface LowLevelBotAPIAccessor { ...@@ -126,7 +126,7 @@ interface LowLevelBotAPIAccessor {
/** /**
* 获取一条群公告 * 获取一条群公告
* @param fid [GroupAnnouncement.fid] * @param fid [GroupAnnouncement.fid]
* */ */
@SinceMirai("0.28.0") @SinceMirai("0.28.0")
@LowLevelAPI @LowLevelAPI
@MiraiExperimentalAPI @MiraiExperimentalAPI
...@@ -135,8 +135,7 @@ interface LowLevelBotAPIAccessor { ...@@ -135,8 +135,7 @@ interface LowLevelBotAPIAccessor {
/** /**
* 获取群活跃信息 * 获取群活跃信息
* */
* */
@LowLevelAPI @LowLevelAPI
@MiraiExperimentalAPI @MiraiExperimentalAPI
suspend fun _lowLevelGetGroupActiveData(groupId: Long): GroupActiveData suspend fun _lowLevelGetGroupActiveData(groupId: Long): GroupActiveData
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment