Commit 2b2edeac authored by Him188's avatar Him188

Support operator in `GroupNameChangeEvent`, optimize logs, close #217

parent 991f46fe
...@@ -120,7 +120,7 @@ internal class GroupImpl( ...@@ -120,7 +120,7 @@ internal class GroupImpl(
newName = newValue newName = newValue
).sendWithoutExpect() ).sendWithoutExpect()
} }
GroupNameChangeEvent(oldValue, newValue, this@GroupImpl, true).broadcast() GroupNameChangeEvent(oldValue, newValue, this@GroupImpl, null).broadcast()
} }
} }
} }
......
...@@ -301,8 +301,16 @@ data class GroupNameChangeEvent( ...@@ -301,8 +301,16 @@ data class GroupNameChangeEvent(
override val origin: String, override val origin: String,
override val new: String, override val new: String,
override val group: Group, override val group: Group,
val isByBot: Boolean // 无法获取操作人 /**
) : GroupSettingChangeEvent<String>, Packet * 操作人. 为 null 时则是机器人操作
*/
@SinceMirai("0.37.3")
override val operator: Member?
) : GroupSettingChangeEvent<String>, Packet, GroupOperableEvent {
@Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN)
val isByBot: Boolean
get() = operator == null
}
/** /**
* 入群公告改变. 此事件广播前修改就已经完成. * 入群公告改变. 此事件广播前修改就已经完成.
......
...@@ -67,7 +67,10 @@ interface GroupOperableEvent : GroupEvent { ...@@ -67,7 +67,10 @@ interface GroupOperableEvent : GroupEvent {
/** /**
* 是否由 [Bot] 操作 * 是否由 [Bot] 操作
*/ */
val GroupOperableEvent.isByBot: Boolean get() = operator == null @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@kotlin.internal.HidesMembers // necessary until 1.0.0
val GroupOperableEvent.isByBot: Boolean
get() = operator == null
/** /**
* 当操作人为 [Member] 时获取这个 [Member], * 当操作人为 [Member] 时获取这个 [Member],
......
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