Add Group.getMember and Group.getMemberOrFail as disambiguation with get in some contexts.

This commit is contained in:
Him188 2020-12-24 14:59:20 +08:00
parent c4791b0a5f
commit 08b46a487c

View File

@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@file:Suppress("EXPERIMENTAL_API_USAGE", "unused", "UnusedImport")
@file:Suppress("EXPERIMENTAL_API_USAGE", "unused", "UnusedImport", "NOTHING_TO_INLINE")
package net.mamoe.mirai.contact
@ -242,6 +242,18 @@ public interface GroupSettings {
public val isAnonymousChatEnabled: Boolean
}
/**
* [get]. 在一些不适合使用 [get] 的情境下使用 [getMember].
*/
@JvmSynthetic
public inline fun Group.getMember(id: Long): NormalMember? = get(id)
/**
* [getMemberOrFail]. 在一些不适合使用 [getOrFail] 的情境下使用 [getMemberOrFail].
*/
@JvmSynthetic
public inline fun Group.getMemberOrFail(id: Long): NormalMember = getOrFail(id)
/**
* 返回机器人是否正在被禁言