Commit ec485a8b authored by Him188's avatar Him188

Cleanup

parent d47c764a
......@@ -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()
/**
* 发送一个包, 挂起协程直到接收到指定的返回包或超时
*/
......
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