-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f4ff2e
commit f10fddc
Showing
5 changed files
with
155 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import hikari | ||
|
||
import arc | ||
|
||
bot = hikari.GatewayBot("...", banner=None) | ||
client = arc.GatewayClient(bot) | ||
|
||
group = client.include_slash_group( | ||
"my_group", "My group description", default_permissions=hikari.Permissions.ADMINISTRATOR | ||
) | ||
|
||
subgroup = group.include_subgroup("my_subgroup", "My subgroup description") | ||
|
||
|
||
@client.include | ||
@arc.message_command("Message Command") | ||
async def among_us(ctx: arc.GatewayContext, message: hikari.Message) -> None: | ||
pass | ||
|
||
|
||
@group.include | ||
@arc.slash_subcommand("test_subcommand", "My subcommand description") | ||
async def my_subcommand( | ||
ctx: arc.GatewayContext, | ||
a: arc.Option[int, arc.IntParams(description="foo", min=10)], | ||
b: arc.Option[str, arc.StrParams(description="bar", min_length=100)], | ||
) -> None: | ||
pass | ||
|
||
|
||
@subgroup.include() | ||
@arc.slash_subcommand("test_subsubcommand", "My subsubcommand description") | ||
async def my_subsubcommand( | ||
ctx: arc.GatewayContext, | ||
a: arc.Option[int, arc.IntParams(description="foo", min=10)], | ||
b: arc.Option[str, arc.StrParams(description="bar", min_length=100)], | ||
) -> None: | ||
pass | ||
|
||
|
||
def test_walk_commands() -> None: | ||
cmds = list(client.walk_commands(callable_only=False)) | ||
|
||
assert len(cmds) == 5 | ||
|
||
assert among_us in cmds | ||
assert my_subcommand in cmds | ||
assert my_subsubcommand in cmds | ||
assert group in cmds | ||
assert subgroup in cmds | ||
|
||
cmds = list(client.walk_commands(callable_only=True)) | ||
|
||
assert len(cmds) == 3 | ||
|
||
assert among_us in cmds | ||
assert my_subcommand in cmds | ||
assert my_subsubcommand in cmds | ||
|
||
cmds = list(client.walk_commands(callable_only=True, types={hikari.CommandType.SLASH})) | ||
|
||
assert len(cmds) == 2 | ||
|
||
assert my_subcommand in cmds | ||
assert my_subsubcommand in cmds |