mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 03:22:36 +08:00
Close #393
This commit is contained in:
parent
9375c0fa7b
commit
510a041f0c
@ -146,7 +146,7 @@ internal class QQAndroidBot constructor(
|
|||||||
|
|
||||||
@Suppress("DuplicatedCode")
|
@Suppress("DuplicatedCode")
|
||||||
@OptIn(LowLevelAPI::class)
|
@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>" }
|
checkGroupPermission(event.bot, event.group) { event::class.simpleName ?: "<anonymous class>" }
|
||||||
check(event.responded.compareAndSet(false, true)) {
|
check(event.responded.compareAndSet(false, true)) {
|
||||||
"the request $this has already been responded"
|
"the request $this has already been responded"
|
||||||
@ -162,7 +162,8 @@ internal class QQAndroidBot constructor(
|
|||||||
fromNick = event.fromNick,
|
fromNick = event.fromNick,
|
||||||
groupId = event.groupId,
|
groupId = event.groupId,
|
||||||
accept = false,
|
accept = false,
|
||||||
blackList = blackList
|
blackList = blackList,
|
||||||
|
message = message
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,7 +756,8 @@ internal abstract class QQAndroidBotBase constructor(
|
|||||||
fromNick: String,
|
fromNick: String,
|
||||||
groupId: Long,
|
groupId: Long,
|
||||||
accept: Boolean?,
|
accept: Boolean?,
|
||||||
blackList: Boolean
|
blackList: Boolean,
|
||||||
|
message: String
|
||||||
) {
|
) {
|
||||||
network.apply {
|
network.apply {
|
||||||
NewContact.SystemMsgNewGroup.Action(
|
NewContact.SystemMsgNewGroup.Action(
|
||||||
@ -765,7 +767,8 @@ internal abstract class QQAndroidBotBase constructor(
|
|||||||
groupId = groupId,
|
groupId = groupId,
|
||||||
isInvited = false,
|
isInvited = false,
|
||||||
accept = accept,
|
accept = accept,
|
||||||
blackList = blackList
|
blackList = blackList,
|
||||||
|
message = message
|
||||||
).sendWithoutExpect()
|
).sendWithoutExpect()
|
||||||
groups[groupId].apply {
|
groups[groupId].apply {
|
||||||
members.delegate.addLast(newMember(object : MemberInfo {
|
members.delegate.addLast(newMember(object : MemberInfo {
|
||||||
|
@ -223,7 +223,8 @@ internal class NewContact {
|
|||||||
groupId: Long,
|
groupId: Long,
|
||||||
isInvited: Boolean,
|
isInvited: Boolean,
|
||||||
accept: Boolean?,
|
accept: Boolean?,
|
||||||
blackList: Boolean = false
|
blackList: Boolean = false,
|
||||||
|
message: String = ""
|
||||||
) =
|
) =
|
||||||
buildOutgoingUniPacket(client) {
|
buildOutgoingUniPacket(client) {
|
||||||
writeProtoBuf(
|
writeProtoBuf(
|
||||||
@ -236,7 +237,7 @@ internal class NewContact {
|
|||||||
false -> 12 // reject
|
false -> 12 // reject
|
||||||
},
|
},
|
||||||
groupCode = groupId,
|
groupCode = groupId,
|
||||||
msg = "",
|
msg = message,
|
||||||
remark = "",
|
remark = "",
|
||||||
blacklist = blackList
|
blacklist = blackList
|
||||||
),
|
),
|
||||||
|
@ -295,7 +295,7 @@ abstract class Bot internal constructor(
|
|||||||
level = DeprecationLevel.ERROR
|
level = DeprecationLevel.ERROR
|
||||||
)
|
)
|
||||||
@JvmSynthetic
|
@JvmSynthetic
|
||||||
abstract suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean = false)
|
abstract suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean = false, message: String = "")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 忽略加群验证(需管理员权限)
|
* 忽略加群验证(需管理员权限)
|
||||||
|
@ -353,7 +353,7 @@ data class MemberJoinRequestEvent internal constructor(
|
|||||||
suspend fun accept() = bot.acceptMemberJoinRequest(this)
|
suspend fun accept() = bot.acceptMemberJoinRequest(this)
|
||||||
|
|
||||||
@JvmSynthetic
|
@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
|
@JvmSynthetic
|
||||||
suspend fun ignore(blackList: Boolean = false) = bot.ignoreMemberJoinRequest(this, blackList)
|
suspend fun ignore(blackList: Boolean = false) = bot.ignoreMemberJoinRequest(this, blackList)
|
||||||
@ -366,8 +366,8 @@ data class MemberJoinRequestEvent internal constructor(
|
|||||||
@JavaFriendlyAPI
|
@JavaFriendlyAPI
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@JvmName("reject")
|
@JvmName("reject")
|
||||||
fun __rejectBlockingForJava__(blackList: Boolean = false) =
|
fun __rejectBlockingForJava__(blackList: Boolean = false, message: String = "") =
|
||||||
runBlocking { bot.rejectMemberJoinRequest(this@MemberJoinRequestEvent, blackList) }
|
runBlocking { bot.rejectMemberJoinRequest(this@MemberJoinRequestEvent, blackList, message) }
|
||||||
|
|
||||||
@JavaFriendlyAPI
|
@JavaFriendlyAPI
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
|
@ -137,5 +137,5 @@ interface LowLevelBotAPIAccessor {
|
|||||||
*/
|
*/
|
||||||
@LowLevelAPI
|
@LowLevelAPI
|
||||||
@MiraiExperimentalAPI
|
@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 = "")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user