mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-17 09:09:23 +08:00
Bot.getFriend
now returns Bot.asFriend
if id == bot.id
This commit is contained in:
parent
d33948ac14
commit
8732cc1fc4
@ -100,9 +100,10 @@ public interface Bot : CoroutineScope, ContactOrBot, UserOrBot {
|
||||
|
||||
/**
|
||||
* 以 [对方 QQ 号码][id] 获取一个好友对象, 在获取失败时返回 `null`.
|
||||
* 在 [id] 与 [Bot.id] 相同时返回 [Bot.asFriend]
|
||||
*/
|
||||
public fun getFriend(id: Long): Friend? =
|
||||
friends.firstOrNull { it.id == id }
|
||||
friends.firstOrNull { it.id == id } ?: asFriend
|
||||
|
||||
/**
|
||||
* 以 [对方 QQ 号码][id] 获取一个好友对象, 在获取失败时抛出 [NoSuchElementException].
|
||||
|
Loading…
Reference in New Issue
Block a user