Skip to content

Commit

Permalink
throw illegal state exception if failed
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXiaoM committed Dec 5, 2023
1 parent e43ec2f commit 6f045b1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class Overflow : IMirai, CoroutineScope, LowLevelApiAccessor, OverflowAPI {
@JvmBlockingBridge
override suspend fun deserializeMessage(bot: Bot, message: String): MessageChain = OnebotMessages.deserializeFromOneBot(bot, message, null)
override suspend fun queryProfile(bot: Bot, targetId: Long): UserProfile {
val data = bot.asOnebot.impl.getUserInfo(targetId, false).data
val data = bot.asOnebot.impl.getUserInfo(targetId, false).data ?: throw IllegalStateException("Can not fetch profile card.")
// TODO: 不确定 birthday 的单位是毫秒还是秒
val age = if (data.birthday > 0) ((currentTimeSeconds() - data.birthday) / 365.daysToSeconds).toInt() else 0
// TODO: 获取性别
Expand Down

0 comments on commit 6f045b1

Please sign in to comment.