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