|
1 | 1 | ---
|
2 |
| -title: Custom events |
| 2 | +title: Custom Events |
3 | 3 | ---
|
4 | 4 |
|
5 | 5 | CommandKit also supports using custom events in the `events`
|
6 | 6 | directory. Custom events must be defined in a namespaced directory,
|
7 |
| -which are primarily handled by plugins. For example, if you have a |
8 |
| -custom event called `guildMemberBoost`, you can create a file called |
9 |
| -`src/app/events/(custom)/guildMemberBoost/handler.ts` which will be |
10 |
| -handled by the appropriate plugins. |
| 7 | +which are primarily handled by plugins. |
11 | 8 |
|
12 |
| -:::info |
| 9 | +For example, if you have a plugin that is handling a custom event |
| 10 | +called `"guildMemberBoost"` under a namespace called `"custom"`, you |
| 11 | +can create a file in the `src/app/events/(custom)/guildMemberBoost` |
| 12 | +directory which will be handled by the appropriate plugin. |
13 | 13 |
|
14 |
| -Event namespace directories are not the same as |
15 |
| -[command categories](../02-commands/06-category-directory.mdx) as they |
16 |
| -serve a different purpose. |
| 14 | +:::warning |
| 15 | + |
| 16 | +The `"custom"` namespace above is just an example. Namespaces will |
| 17 | +generally be set by plugins, so make sure to check the plugin's |
| 18 | +documentation for the correct one. |
17 | 19 |
|
18 | 20 | :::
|
19 | 21 |
|
20 |
| -The usage of custom events is the same way as |
21 |
| -[Discord.js events](./01-discordjs-events.mdx). The only difference is |
22 |
| -that these events are namespaced and are primarily handled by plugins. |
| 22 | +:::danger |
| 23 | + |
| 24 | +Event namespace directories are **not** the same as |
| 25 | +[command categories](../02-commands/06-category-directory.mdx). |
| 26 | + |
| 27 | +::: |
23 | 28 |
|
24 | 29 | ## How plugins execute namespaced events
|
25 | 30 |
|
|
0 commit comments