Skip to content

Commit fc8fd70

Browse files
committed
Optimized IMirai.getUin()
1 parent 98bca6a commit fc8fd70

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

mirai-core/src/commonMain/kotlin/MiraiImpl.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,15 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
861861
}
862862
}
863863

864+
override fun getUin(contactOrBot: ContactOrBot): Long {
865+
return when (contactOrBot) {
866+
is Group -> contactOrBot.uin
867+
is User -> contactOrBot.uin
868+
is Bot -> contactOrBot.uin
869+
else -> contactOrBot.id
870+
}
871+
}
872+
864873
override fun constructMessageSource(
865874
botId: Long,
866875
kind: MessageSourceKind,

0 commit comments

Comments
 (0)