mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 11:30:16 +08:00
Bot.otherClients now does not include self, close #770
This commit is contained in:
parent
d4a8573772
commit
5196cc410a
@ -187,10 +187,12 @@ public interface IMirai : LowLevelApiAccessor {
|
||||
|
||||
/**
|
||||
* 获取在线的 [OtherClient] 列表
|
||||
* @param mayIncludeSelf 服务器返回的列表可能包含 [Bot] 自己. [mayIncludeSelf] 为 `false` 会排除自己
|
||||
*/
|
||||
@JvmBlockingBridge
|
||||
public suspend fun getOnlineOtherClientsList(
|
||||
bot: Bot,
|
||||
mayIncludeSelf: Boolean = false
|
||||
): List<OtherClientInfo>
|
||||
|
||||
/**
|
||||
|
@ -159,7 +159,7 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
group.checkBotPermission(MemberPermission.ADMINISTRATOR)
|
||||
}
|
||||
|
||||
override suspend fun getOnlineOtherClientsList(bot: Bot): List<OtherClientInfo> {
|
||||
override suspend fun getOnlineOtherClientsList(bot: Bot, mayIncludeSelf: Boolean): List<OtherClientInfo> {
|
||||
bot.asQQAndroidBot()
|
||||
val response = bot.network.run {
|
||||
StatSvc.GetDevLoginInfo(bot.client).sendAndExpect<StatSvc.GetDevLoginInfo.Response>()
|
||||
@ -172,7 +172,9 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
deviceTypeInfo.orEmpty()
|
||||
)
|
||||
|
||||
return response.deviceList.map { it.toOtherClientInfo() }
|
||||
return response.deviceList.map { it.toOtherClientInfo() }.let { result ->
|
||||
if (mayIncludeSelf) result else result.filterNot { it.appId == bot.client.protocol.id.toInt() }
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun ignoreMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean) {
|
||||
|
Loading…
Reference in New Issue
Block a user