mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 10:30:13 +08:00
Don't show not permitted commands in /help
This commit is contained in:
parent
0fa67b7699
commit
2e286a3a79
@ -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}"
|
||||
|
Loading…
Reference in New Issue
Block a user