From 2e286a3a79213d12a4763f6e124fd5cf6ebe6d54 Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Sat, 20 Feb 2021 19:51:23 +0800 Subject: [PATCH] Don't show not permitted commands in `/help` --- backend/mirai-console/src/command/BuiltInCommands.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/mirai-console/src/command/BuiltInCommands.kt b/backend/mirai-console/src/command/BuiltInCommands.kt index a5d15c74f..e16d16242 100644 --- a/backend/mirai-console/src/command/BuiltInCommands.kt +++ b/backend/mirai-console/src/command/BuiltInCommands.kt @@ -37,6 +37,7 @@ import net.mamoe.mirai.console.permission.PermissionService import net.mamoe.mirai.console.permission.PermissionService.Companion.cancel import net.mamoe.mirai.console.permission.PermissionService.Companion.findCorrespondingPermissionOrFail import net.mamoe.mirai.console.permission.PermissionService.Companion.getPermittedPermissions +import net.mamoe.mirai.console.permission.PermissionService.Companion.hasPermission import net.mamoe.mirai.console.permission.PermissionService.Companion.permit import net.mamoe.mirai.console.permission.PermitteeId import net.mamoe.mirai.console.plugin.name @@ -98,6 +99,7 @@ public object BuiltInCommands { public suspend fun CommandSender.handle() { sendMessage( allRegisteredCommands + .filter { hasPermission(it.permission) } .joinToString("\n\n") { command -> val lines = command.usage.lines() if (lines.isEmpty()) "/${command.primaryName} ${command.description}"