Add documentation

This commit is contained in:
Ethan Lane 2022-04-06 20:08:10 +01:00
parent 5de2b4bd45
commit a607521986
Signed by: Vylpes
GPG key ID: EED233CC06D12504
2 changed files with 72 additions and 9 deletions

View file

@ -1,6 +1,6 @@
# VylBot App
Discord bot for Vylpes' Den Discord Server. Based on [VylBot Core](https://github.com/getgravitysoft/vylbot-core).
Discord bot for Vylpes' Den Discord Server.
## Installation
@ -8,16 +8,48 @@ Download the latest version from the [releases page](https://github.com/Vylpes/v
Copy the config template file and fill in the strings.
## Requirements
- NodeJS v16
- Yarn
## Usage
Implement the client using something like:
Install the dependencies and build the app:
```js
const vylbot = require('vylbot-core');
const config = require('./config.json');
const client = new vylbot.client(config);
client.start();
```bash
yarn install
yarn build
```
See the `docs` folder for more information on how to use vylbot-core
Setup the database (Recommended to use the docker-compose file)
```bash
docker-compose up -d
```
Copy and edit the settings files
```bash
cp .env.template .env
# Edit the .env file
cp ormconfig.json.template ormconfig.json
# Edit the ormconfig.json file
```
> **NOTE:** Make sure you do *not* check in these files! These contain sensitive information and should be treated as private.
Start the bot
```bash
yarn start
```
Alternatively, you can start the bot in development mode using:
```bash
yarn start --dev
```
> Dev mode ensures that the default prefix is different to the production mode, in case you have both running in the same server.

31
docs/Registry.md Normal file
View file

@ -0,0 +1,31 @@
# Registry
The registry file is what is used to register the bot's commands and events. This is a script which is ran at startup and adds all the commands and events to the bot.
Although you can register these outside of the registry file, this script makes it a centralised place for it to be done at.
## Adding Commands
Commands are added in the `RegisterCommands` function.
The basic syntax is as follows:
```ts
client.RegisterCommand("Name", new Command(), "ServerId");
```
- `"Name"`: The name of the command, will be used by the user to call the command
- `new Command()`: The command class to be executed, must inherit the Command class
- `"ServerId"` (Optional): If given, will only be usable in that specific server
## Adding Events
Events are added in the `RegisterEvents` function.
The basic syntax is as follows:
```ts
client.RegisterEvent(new Events());
```
- `new Events()`: The event class to be executed