feat: cleaning up, adding admonitions

This commit is contained in:
Jacob Nguyen
2022-08-13 13:45:13 -05:00
parent 211aeaefbd
commit a128e8dee6
4 changed files with 25 additions and 12 deletions

View File

@@ -6,15 +6,23 @@ sidebar_position: 2
Setting up the [CLI](https://github.com/sern-handler/cli) is easy. <br />
- To start a brand-new project, run :
```
```sh
sern init (-y)
```
:::tip
It creates a directory for you so you don't need to!
:::
Include the `-y` flag if you want to set up defaults. The default langauge is [Typescript](https://www.typescriptlang.org/) <br />
- To install [plugins](plugins.md) maintained by the community [repository](https://github.com/sern-handler/awesome-plugins),
```
sern plugins
```
:::info
Make sure to have a correct [sern.config.json](./good-to-know.md#sernconfigjson)
:::
This will display a menu selection of all installable plugins. <br />
**Note**: You must have a [sern.config.json](good-to-know.md) to use this command.
If you want to view plugins, visit the repository linked above.
@@ -22,4 +30,5 @@ If you want to view plugins, visit the repository linked above.
- To install extra utilities into your project
```
sern extra
```
```

View File

@@ -2,8 +2,8 @@
sidebar_position: 4
---
# Your first event module
We will dissect a basic event module. <br/ >
# First Event Module
We will dissect a basic event module. <br />
Typescript:
```typescript
export default eventModule({

View File

@@ -96,8 +96,10 @@ export function inDir(dir : string) {
}
```
Above, this simple plugin logs that the module has been loaded along with a timestamp. <br />
Again, it is up to **you** to define plugin logic! The possibilities to customize your bots is endless.
Again, it is up to **you** to define plugin logic! The possibilities to customize your bots are endless.
:::tip
Command Plugins are good for ensuring the shape, location, and preprocessing of your commands.
:::
## Event Plugins
![event-plugins](../../../assets/images/eventplugins.drawio.svg) <br />
- An event is emitted by discord.js.
@@ -106,9 +108,6 @@ Again, it is up to **you** to define plugin logic! The possibilities to customiz
The command is executed. Calling `controller.stop()` notifies sern that this command should not be run,
and this event is ignored.
<br /> <br />
This flexible structure allows you to write reusable preconditions, permissions verifiers,
argument verifiers, and much more.
<p>So, what does a command module look like with plugins?</p>
@@ -151,4 +150,8 @@ Can you predict the behavior of this command?
- Before loading into sern, this command module will check if this module is in the correct directory `other`.
- Before an event occurs, this command module will check if the user has the id `182326315813306368`.
:::tip
Event Plugins are good for filtering, preconditions, parsing.
:::
If all plugins return `controller.next()`, this command replies `Pong 🏓`

View File

@@ -6,7 +6,8 @@ sidebar_position: 6
You're shipped with the SernEmitter. This EventEmitter listens to
- command modules executing and its status, the `module.activate` event
- command modules registered and its status, the `module.register` event
- any errors that are recoverable, the `error` event
- any error that occurs, the `error` event
- `warn` events, where it is possible to throw errors
<br /> You can put these and other event listeners into event modules!
<br /> View all <a href="https://sern-handler.js.org/docs/api/modules#serneventsmapping">events</a>
You can put these and other event listeners into [event modules](./first-event.md)!
<br/>View all <a href="https://sern-handler.js.org/docs/api/modules#serneventsmapping">events</a>