mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-14 20:50:09 +08:00
Fix Bot.getFriend
This commit is contained in:
parent
8e93a2c32f
commit
c966d9840e
@ -103,7 +103,7 @@ public interface Bot : CoroutineScope, ContactOrBot, UserOrBot {
|
||||
* 在 [id] 与 [Bot.id] 相同时返回 [Bot.asFriend]
|
||||
*/
|
||||
public fun getFriend(id: Long): Friend? =
|
||||
friends.firstOrNull { it.id == id } ?: asFriend
|
||||
friends.firstOrNull { it.id == id } ?: if (id == this.id) asFriend else null
|
||||
|
||||
/**
|
||||
* 以 [对方 QQ 号码][id] 获取一个好友对象, 在获取失败时抛出 [NoSuchElementException].
|
||||
|
Loading…
Reference in New Issue
Block a user