-
-
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
b2de0e2
commit 588aebf
Showing
26 changed files
with
147 additions
and
44 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
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,35 @@ | ||
import hikari | ||
import arc | ||
|
||
# Define a custom bot class that extends hikari.GatewayBot | ||
# Note that this is not strictly required, but is possible | ||
class MyBot(hikari.GatewayBot): | ||
|
||
def custom_method(self) -> str: | ||
return "I'm doing stuff!" | ||
|
||
# You should inherit from arc.GatewayClientBase | ||
# and specify the bot class that your client will use | ||
# If you do not have a custom bot class, you can use hikari.GatewayBot here | ||
class MyClient(arc.GatewayClientBase[MyBot]): | ||
|
||
def custom_client_method(self) -> None: | ||
print(self.app.custom_method()) | ||
|
||
# Optional but recommended: | ||
# Create type aliases for your context and plugin types | ||
MyContext = arc.Context[MyClient] | ||
MyPlugin = arc.GatewayPluginBase[MyClient] | ||
|
||
# Create your bot instance and client instance | ||
bot = MyBot("...", banner=None) | ||
client = MyClient(bot) | ||
|
||
# Use in commands like normal | ||
@client.include() | ||
@arc.slash_command("test", "My command description") | ||
async def my_command(ctx: MyContext) -> None: | ||
ctx.client.custom_client_method() | ||
await ctx.respond(ctx.client.app.custom_method()) | ||
|
||
bot.run() |
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
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
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,35 @@ | ||
import hikari | ||
import arc | ||
|
||
# Define a custom bot class that extends hikari.RESTBot | ||
# Note that this is not strictly required, but is possible | ||
class MyBot(hikari.RESTBot): | ||
|
||
def custom_method(self) -> str: | ||
return "I'm doing stuff!" | ||
|
||
# You should inherit from arc.RESTClientBase | ||
# and specify the bot class that your client will use | ||
# If you do not have a custom bot class, you can use hikari.RESTBot here | ||
class MyClient(arc.RESTClientBase[MyBot]): | ||
|
||
def custom_client_method(self) -> None: | ||
print(self.app.custom_method()) | ||
|
||
# Optional but recommended: | ||
# Create type aliases for your context and plugin types | ||
MyContext = arc.Context[MyClient] | ||
MyPlugin = arc.RESTPluginBase[MyClient] | ||
|
||
# Create your bot instance and client instance | ||
bot = MyBot("...", banner=None) | ||
client = MyClient(bot) | ||
|
||
# Use in commands like normal | ||
@client.include() | ||
@arc.slash_command("test", "My command description") | ||
async def my_command(ctx: MyContext) -> None: | ||
ctx.client.custom_client_method() | ||
await ctx.respond(ctx.client.app.custom_method()) | ||
|
||
bot.run() |
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
Oops, something went wrong.