mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-13 06:30:13 +08:00
Cleanup
This commit is contained in:
parent
d47c764a81
commit
ec485a8b6f
@ -181,8 +181,10 @@ internal class QQAndroidBot constructor(
|
||||
val group = this.getGroupOrNull(eventGroup.id)
|
||||
?: kotlin.run {
|
||||
if (this == eventBot) {
|
||||
error("A ${eventName()} is outdated. Group ${eventGroup.id} not found for bot ${this.id}. " +
|
||||
"This is because bot isn't in the group anymore")
|
||||
error(
|
||||
"A ${eventName()} is outdated. Group ${eventGroup.id} not found for bot ${this.id}. " +
|
||||
"This is because bot isn't in the group anymore"
|
||||
)
|
||||
} else {
|
||||
error("A ${eventName()} is from bot ${eventBot.id}, but you are trying to respond it using bot ${this.id} who isn't a member of the group ${eventGroup.id}")
|
||||
}
|
||||
@ -206,11 +208,11 @@ internal class QQAndroidBot constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun acceptInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent)
|
||||
= solveInvitedJoinGroupRequest(event, accept = true)
|
||||
override suspend fun acceptInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) =
|
||||
solveInvitedJoinGroupRequest(event, accept = true)
|
||||
|
||||
override suspend fun ignoreInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent)
|
||||
= solveInvitedJoinGroupRequest(event, accept = false)
|
||||
override suspend fun ignoreInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) =
|
||||
solveInvitedJoinGroupRequest(event, accept = false)
|
||||
|
||||
|
||||
private suspend fun solveInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent, accept: Boolean) {
|
||||
@ -295,6 +297,7 @@ internal abstract class QQAndroidBotBase constructor(
|
||||
}
|
||||
|
||||
override val groups: ContactList<Group> = ContactList(LockFreeLinkedList())
|
||||
|
||||
@JvmField
|
||||
val groupListModifyLock = Mutex()
|
||||
|
||||
|
@ -445,12 +445,7 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
|
||||
return this.launch(
|
||||
start = CoroutineStart.ATOMIC
|
||||
) {
|
||||
try {
|
||||
input.use { parsePacket(it) }
|
||||
} catch (e: Exception) {
|
||||
// 傻逼协程吞异常
|
||||
logger.error(e)
|
||||
}
|
||||
input.use { parsePacket(it) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -620,8 +615,6 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
|
||||
channel.send(delegate)
|
||||
}
|
||||
|
||||
class TimeoutException(override val message: String?) : Exception()
|
||||
|
||||
/**
|
||||
* 发送一个包, 挂起协程直到接收到指定的返回包或超时
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user