Skip to content

Commit

Permalink
Update docstring examples
Browse files Browse the repository at this point in the history
  • Loading branch information
hypergonial committed Dec 31, 2023
1 parent beb023a commit d9f3d7c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ client = arc.GatewayClient(bot) # or arc.RESTClient
@client.include
@arc.slash_command(name="hi", description="Say hi!")
async def ping(
ctx: arc.Context[arc.GatewayClient],
ctx: arc.GatewayContext,
user: arc.Option[hikari.User, arc.UserParams(description="The user to say hi to.")]
) -> None:
await ctx.respond(f"Hey {user.mention}!")
Expand Down
6 changes: 3 additions & 3 deletions arc/abc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def include_slash_group(
@group.include
@arc.slash_subcommand(name="Command", description="A command.")
async def cmd(ctx: arc.Context[arc.GatewayClient]) -> None:
async def cmd(ctx: arc.GatewayContext) -> None:
await ctx.respond("Hello!")
```
"""
Expand Down Expand Up @@ -443,7 +443,7 @@ def load_extension(self, path: str) -> te.Self:
# In extension.py
plugin = arc.GatewayPlugin[arc.GatewayClient]("test_plugin")
plugin = arc.GatewayPlugin("test_plugin")
@arc.loader
def loader(client: arc.GatewayClient) -> None:
Expand Down Expand Up @@ -590,7 +590,7 @@ def __init__(self, value: str):
@client.include
@arc.slash_command("cmd", "A command.")
async def cmd(ctx: arc.Context[arc.GatewayClient], dep: MyDependency = arc.inject()) -> None:
async def cmd(ctx: arc.GatewayContext, dep: MyDependency = arc.inject()) -> None:
await ctx.respond(dep.value)
```
Expand Down
4 changes: 2 additions & 2 deletions arc/abc/error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def set_error_handler(self, callback: ErrorHandlerCallbackT[ClientT]) -> ErrorHa
```py
@client.include
@arc.slash_command("foo", "Foo command description")
async def foo(ctx: arc.Context[ClientT]) -> None:
async def foo(ctx: arc.GatewayContext) -> None:
raise Exception("foo")
@foo.set_error_handler
async def foo_error_handler(ctx: arc.Context[ClientT], exc: Exception) -> None:
async def foo_error_handler(ctx: arc.GatewayContext, exc: Exception) -> None:
await ctx.respond("foo failed")
```
"""
Expand Down
2 changes: 1 addition & 1 deletion arc/command/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def message_command(
@client.include
@arc.message_command(name="Say Hi", description="Say hi!")
async def hi_msg(
ctx: arc.Context[arc.GatewayClient], message: hikari.Message
ctx: arc.GatewayContext, message: hikari.Message
) -> None:
await ctx.respond(f"Hey {message.author}!")
```
Expand Down
4 changes: 2 additions & 2 deletions arc/command/slash.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def slash_command(
@client.include
@arc.slash_command(name="hi", description="Say hi!")
async def hi_slash(
ctx: arc.Context[arc.GatewayClient],
ctx: arc.GatewayContext,
user: arc.Option[hikari.User, arc.UserParams(description="The user to say hi to.")]
) -> None:
await ctx.respond(f"Hey {user.mention}!")
Expand Down Expand Up @@ -700,7 +700,7 @@ def slash_subcommand(
@group.include
@arc.slash_subcommand(name="hi", description="Say hi!")
async def hi_slashsub(
ctx: arc.Context[arc.GatewayClient],
ctx: arc.GatewayContext,
user: arc.Option[hikari.User, arc.UserParams(description="The user to say hi to.")]
) -> None:
await ctx.respond(f"Hey {user.mention}!")
Expand Down
2 changes: 1 addition & 1 deletion arc/command/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def user_command(
```py
@client.include
@arc.user_command(name="Say Hi", description="Say hi!")
async def hi_user(ctx: arc.Context[arc.GatewayClient], user: hikari.User) -> None:
async def hi_user(ctx: arc.GatewayContext, user: hikari.User) -> None:
await ctx.respond(f"Hey {user.mention}!")
```
"""
Expand Down
2 changes: 1 addition & 1 deletion arc/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def include_slash_group(
@group.include
@arc.slash_subcommand(name="Command", description="A command.")
async def cmd(ctx: arc.Context[arc.GatewayClient]) -> None:
async def cmd(ctx: arc.GatewayContext) -> None:
await ctx.respond("Hello!")
```
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sigparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __init__(self, val: int) -> None:


async def di_annotation(
ctx: arc.Context[arc.GatewayClient],
ctx: arc.GatewayContext,
a: arc.Option[int, arc.IntParams(description="foo", min=10)],
c: arc.Option[str, arc.StrParams(name="b", description="bar", min_length=100)],
b: MyType = arc.inject(),
Expand Down

0 comments on commit d9f3d7c

Please sign in to comment.