Skip to content

Commit

Permalink
support Member.muteTimeRemaining (go-cqhttp)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXiaoM committed Jan 6, 2024
1 parent 17c4f38 commit ef69b62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class GroupMemberInfoResp {
@SerializedName("card_changeable")
public boolean cardChangeable;


@SerializedName("shut_up_timestamp")
public long shutUpTimestamp;

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ class MemberWrapper(
get() = impl.joinTime
override val lastSpeakTimestamp: Int
get() = impl.lastSentTime
var _muteTimestamp: Int = 0 // TODO: Onebot 无法获取禁言剩余时间
override val muteTimeRemaining: Int
get() = if (_muteTimestamp == 0 || _muteTimestamp == 0xFFFFFFFF.toInt()) {
0
} else {
(_muteTimestamp - currentTimeSeconds().toInt()).coerceAtLeast(0)
}
get() = (impl.shutUpTimestamp - currentTimeSeconds()).takeIf { it > 0 }?.toInt() ?: 0

override val coroutineContext: CoroutineContext = CoroutineName("((Bot/${bot.id})Group/${group.id})Member/$id")
override var nameCard: String
get() = impl.card ?: ""
Expand Down

0 comments on commit ef69b62

Please sign in to comment.