🔨 Implement command options (subcommands)
See original GitHub issueFeature
Implement subcommands. So that eg the following data gets sent to discord:
{
"name": "permissions",
"description": "Get or edit permissions for a user or a role",
"options": [
{
"name": "user",
"description": "Get or edit permissions for a user",
"type": 2, // 2 is type SUB_COMMAND_GROUP
"options": [
{
"name": "get",
"description": "Get permissions for a user",
"type": 1, // 1 is type SUB_COMMAND
"options": [
{
"name": "user",
"description": "The user to get",
"type": 6, // 6 is type USER
"required": true
},
{
"name": "channel",
"description": "The channel permissions to get. If omitted, the guild permissions will be returned",
"type": 7, // 7 is type CHANNEL
"required": false
}
]
},
{
"name": "edit",
"description": "Edit permissions for a user",
"type": 1,
"options": [
{
"name": "user",
"description": "The user to edit",
"type": 6,
"required": true
},
{
"name": "channel",
"description": "The channel permissions to edit. If omitted, the guild permissions will be edited",
"type": 7,
"required": false
}
]
}
]
},
{
"name": "role",
"description": "Get or edit permissions for a role",
"type": 2,
"options": [
{
"name": "get",
"description": "Get permissions for a role",
"type": 1,
"options": [
{
"name": "role",
"description": "The role to get",
"type": 8, // 8 is type ROLE
"required": true
},
{
"name": "channel",
"description": "The channel permissions to get. If omitted, the guild permissions will be returned",
"type": 7,
"required": false
}
]
},
{
"name": "edit",
"description": "Edit permissions for a role",
"type": 1,
"options": [
{
"name": "role",
"description": "The role to edit",
"type": 8,
"required": true
},
{
"name": "channel",
"description": "The channel permissions to edit. If omitted, the guild permissions will be edited",
"type": 7,
"required": false
}
]
}
]
}
]
}
Code implementation
Open for discussion, please post suggestions on how you’d like to use this in the lib.
Useful link(s)
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Clikt - Common Options With Subcommands
You can define your options on the root command and pass down the information via the context. With this design, you'll have to...
Read more >How to add common options to sub commands which can go ...
Yes you can add common options to sub commands which can go after the name of the sub command. You ...
Read more >Hammer cheat sheet - Red Hat Customer Portal
You can use Hammer to configure and manage a Red Hat Satellite Server through either CLI commands or automation in shell scripts. The...
Read more >Enter Commands, Parameters, Subcommands, and Line ...
The COMMANDS command distinguishes the type of command to use. COMMANDS has PRI, FUNC, or SUB for Primary, Function, and Subcommand. PRI. The...
Read more >Pixelmon spawn command - Divadonna.it
Note: Command syntax is displayed in the standard Minecraft command format. ... Place the disc on a Pixelmon anvil, and use a hammer...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mwath yeah, like I said I’d like to do it through type annotations. (So your
Using the function as type hint
). Which is a system that could work. But I also quote:I just haven't figured out yet how to do groups properly.
Thanks for the suggestions tho, and its great to see that we’re on the same page. 😊
Guess ill go with that method since it seems really maintainable