Feature/66 add different commands per server #122
2 changed files with 72 additions and 9 deletions
50
README.md
50
README.md
|
@ -1,6 +1,6 @@
|
||||||
# VylBot App
|
# 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
|
## 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.
|
Copy the config template file and fill in the strings.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- NodeJS v16
|
||||||
|
- Yarn
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Implement the client using something like:
|
Install the dependencies and build the app:
|
||||||
|
|
||||||
```js
|
```bash
|
||||||
const vylbot = require('vylbot-core');
|
yarn install
|
||||||
const config = require('./config.json');
|
yarn build
|
||||||
|
|
||||||
const client = new vylbot.client(config);
|
|
||||||
client.start();
|
|
||||||
```
|
```
|
||||||
|
|
||||||
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
31
docs/Registry.md
Normal 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
|
Loading…
Reference in a new issue