This commit is contained in:
ryoii 2020-06-26 19:51:10 +08:00
parent 9375c0fa7b
commit 510a041f0c
5 changed files with 15 additions and 11 deletions

View File

@ -146,7 +146,7 @@ internal class QQAndroidBot constructor(
@Suppress("DuplicatedCode")
@OptIn(LowLevelAPI::class)
override suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean) {
override suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean, message: String) {
checkGroupPermission(event.bot, event.group) { event::class.simpleName ?: "<anonymous class>" }
check(event.responded.compareAndSet(false, true)) {
"the request $this has already been responded"
@ -162,7 +162,8 @@ internal class QQAndroidBot constructor(
fromNick = event.fromNick,
groupId = event.groupId,
accept = false,
blackList = blackList
blackList = blackList,
message = message
)
}
@ -755,7 +756,8 @@ internal abstract class QQAndroidBotBase constructor(
fromNick: String,
groupId: Long,
accept: Boolean?,
blackList: Boolean
blackList: Boolean,
message: String
) {
network.apply {
NewContact.SystemMsgNewGroup.Action(
@ -765,7 +767,8 @@ internal abstract class QQAndroidBotBase constructor(
groupId = groupId,
isInvited = false,
accept = accept,
blackList = blackList
blackList = blackList,
message = message
).sendWithoutExpect()
groups[groupId].apply {
members.delegate.addLast(newMember(object : MemberInfo {

View File

@ -223,7 +223,8 @@ internal class NewContact {
groupId: Long,
isInvited: Boolean,
accept: Boolean?,
blackList: Boolean = false
blackList: Boolean = false,
message: String = ""
) =
buildOutgoingUniPacket(client) {
writeProtoBuf(
@ -236,7 +237,7 @@ internal class NewContact {
false -> 12 // reject
},
groupCode = groupId,
msg = "",
msg = message,
remark = "",
blacklist = blackList
),

View File

@ -295,7 +295,7 @@ abstract class Bot internal constructor(
level = DeprecationLevel.ERROR
)
@JvmSynthetic
abstract suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean = false)
abstract suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean = false, message: String = "")
/**
* 忽略加群验证需管理员权限

View File

@ -353,7 +353,7 @@ data class MemberJoinRequestEvent internal constructor(
suspend fun accept() = bot.acceptMemberJoinRequest(this)
@JvmSynthetic
suspend fun reject(blackList: Boolean = false) = bot.rejectMemberJoinRequest(this, blackList)
suspend fun reject(blackList: Boolean = false, message: String = "") = bot.rejectMemberJoinRequest(this, blackList, message)
@JvmSynthetic
suspend fun ignore(blackList: Boolean = false) = bot.ignoreMemberJoinRequest(this, blackList)
@ -366,8 +366,8 @@ data class MemberJoinRequestEvent internal constructor(
@JavaFriendlyAPI
@JvmOverloads
@JvmName("reject")
fun __rejectBlockingForJava__(blackList: Boolean = false) =
runBlocking { bot.rejectMemberJoinRequest(this@MemberJoinRequestEvent, blackList) }
fun __rejectBlockingForJava__(blackList: Boolean = false, message: String = "") =
runBlocking { bot.rejectMemberJoinRequest(this@MemberJoinRequestEvent, blackList, message) }
@JavaFriendlyAPI
@JvmOverloads

View File

@ -137,5 +137,5 @@ interface LowLevelBotAPIAccessor {
*/
@LowLevelAPI
@MiraiExperimentalAPI
suspend fun _lowLevelSolveMemberJoinRequestEvent(eventId: Long, fromId: Long, fromNick: String, groupId: Long, accept: Boolean?, blackList: Boolean)
suspend fun _lowLevelSolveMemberJoinRequestEvent(eventId: Long, fromId: Long, fromNick: String, groupId: Long, accept: Boolean?, blackList: Boolean, message: String = "")
}