Bläddra i källkod

Fix wrong error message

sandtechnology 5 år sedan
förälder
incheckning
67f7be34a3
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. 2 2
      mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt

+ 2 - 2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt

@@ -115,7 +115,7 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
      * 获取一个好友对象.
      * @throws [NoSuchElementException] 当不存在这个好友时抛出
      */
-    fun getFriend(id: Long): QQ = friends.firstOrNull { it.id == id } ?: throw NoSuchElementException("group $id")
+    fun getFriend(id: Long): QQ = friends.firstOrNull { it.id == id } ?: throw NoSuchElementException("friend $id")
 
     /**
      * 机器人加入的群列表. 与服务器同步更新
@@ -343,4 +343,4 @@ inline fun Bot.containsGroup(id: Long): Boolean = this.groups.contains(id)
 inline fun Bot.getFriendOrNull(id: Long): QQ? = this.friends.getOrNull(id)
 
 @JvmSynthetic
-inline fun Bot.getGroupOrNull(id: Long): Group? = this.groups.getOrNull(id)
+inline fun Bot.getGroupOrNull(id: Long): Group? = this.groups.getOrNull(id)