-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: rewrite commands to use DJS builders, allow guild commands and…
… create CommandDeployer
- Loading branch information
Showing
83 changed files
with
1,852 additions
and
1,970 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: 🪐 Command Deployer | ||
--- | ||
|
||
The `CommandDeployer` is the object responsible for deploying commands. It's stored by a `CommandManager`, and you can get | ||
it via `CommandManager#getDeployer()`. | ||
|
||
You can't modify the repository directly since the `CommandManager` returns a `ReadonlyCommandDeployer` type, but the | ||
hidden methods are available at the `CommandManager`. This is because adding, removing and updating a command needs more | ||
logic than just modifying the repository, and the manager is responsible for coordinating this. | ||
|
||
## 👷 Creation | ||
|
||
You can create a command deployer by either: | ||
|
||
* Extending `DefaultCommandDeployer` from `@framework` (recommended). | ||
* Implementing the `CommandDeployer` interface from `@core`. | ||
|
||
```mdx-code-block | ||
<Tabs> | ||
<TabItem value="Extending DefaultCommandDeployer"> | ||
``` | ||
|
||
```ts | ||
class MyCommandDeployer extends DefaultCommandDeployer { | ||
// ... | ||
} | ||
|
||
const myBot = Bot.create((bot) => ({ | ||
commands: DefaultCommandManager.create(bot, client, clientBus, { deployer: myDeployer }), | ||
})) | ||
``` | ||
|
||
```mdx-code-block | ||
</TabItem> | ||
<TabItem value="Implementing CommandDeployer"> | ||
``` | ||
|
||
```ts | ||
class MyCommandDeployer implements CommandDeployer { | ||
// ... | ||
} | ||
|
||
const myBot = Bot.create((bot) => ({ | ||
commands: DefaultCommandManager.create(bot, client, clientBus, { deployer: myDeployer }), | ||
})) | ||
``` | ||
|
||
```mdx-code-block | ||
</TabItem> | ||
</Tabs> | ||
``` | ||
|
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.