mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-03 01:39:35 +08:00
Improve stability, returns -1 for sequenceId when failed to fetch from server
This commit is contained in:
parent
a084eac8be
commit
f653f33a6f
@ -128,8 +128,8 @@ internal class MessageSourceToGroupImpl(
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
override val sequenceId: Int
|
||||
get() = when {
|
||||
sequenceIdDeferred.isCompleted -> sequenceIdDeferred.getCompleted() ?: 0
|
||||
!sequenceIdDeferred.isActive -> 0
|
||||
sequenceIdDeferred.isCompleted -> sequenceIdDeferred.getCompleted() ?: -1
|
||||
!sequenceIdDeferred.isActive -> -1
|
||||
else -> error("sequenceId not yet available")
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<MessageSo
|
||||
abstract val bot: Bot
|
||||
|
||||
/**
|
||||
* 消息 id (序列号).
|
||||
* 消息 id (序列号). 在获取失败时 (概率很低) 为 `-1`.
|
||||
**
|
||||
* #### 值域
|
||||
* 值的范围约为 [UShort] 的范围.
|
||||
|
Loading…
Reference in New Issue
Block a user