-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from Mimickal/v2-docs
- Loading branch information
Showing
6 changed files
with
115 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Hosting your own instance | ||
|
||
This bot is built on [discord.js](https://discord.js.org/#/) v13, so you'll need | ||
Node.js 16.6.0 (or newer) installed. You will also need your own Discord bot | ||
account. If your platform does not have Node.js 16.6.0, consider using something | ||
like https://github.com/nvm-sh/nvm. | ||
|
||
This guide assumes you're hosting on a Linux distro with `systemd`. The bot will | ||
work on other platforms, but you're on your own figuring that out. | ||
|
||
## Running as a user (in dev-mode) | ||
Quick and easy. Also (mostly) platform-independent! | ||
|
||
Create a file `config.json` and paste in the following (obviously fill in the | ||
blanks with your bot's info): | ||
```json | ||
{ | ||
"token": "<your token here>", | ||
"app_id": "<your bot application ID here>" | ||
} | ||
``` | ||
|
||
Install dependencies, register Discord slash commands, and set up the database | ||
for your bot: | ||
``` | ||
git clone https://github.com/Mimickal/ReactionRoleBot.git | ||
cd ReactionRoleBot | ||
npm ci | ||
npm run register path/to/your/config.json | ||
npm run knex migrate:latest | ||
``` | ||
|
||
Start the bot: | ||
``` | ||
npm start path/to/your/config.json | ||
``` | ||
|
||
## Running as a service | ||
A little more effort to set up, but better for long-term use. | ||
|
||
The provided service file expects to find the bot code at | ||
`/srv/discord/ReactionRoleBot/`, and will want to create the sqlite database at | ||
`/srv/discord/rolebot.sqlite`. The easiest way to do this is to create a | ||
`/srv/discord` directory, and `chown` it so it belongs to the user running the | ||
bot. | ||
|
||
Create a file `/etc/discord/ReactionRoleBot/config.json` and paste in the | ||
following (obviously fill in the blanks with your bot's info): | ||
```json | ||
{ | ||
"token": "<your token here>", | ||
"app_id": "<your bot application ID here>" | ||
} | ||
``` | ||
|
||
The following will prepare the bot to run by installing dependencies, | ||
registering slash commands for your Discord bot account, and setting up the | ||
bot's database. Run this from `/srv/discord`: | ||
``` | ||
git clone https://github.com/Mimickal/ReactionRoleBot.git | ||
cd ReactionRoleBot | ||
npm ci | ||
npm run register /etc/discord/ReactionRoleBot/config.json | ||
NODE_ENV=prod npm run knex migrate:latest | ||
``` | ||
|
||
Add your user to `reactionrolebot.service`, then install it into | ||
`/etc/systemd/system/` (just copy the file into that directory). This service | ||
file depends on the above directories, so if you want to change them, you'll | ||
also need to edit those fields. If you are using `nvm`, you may need to tweak | ||
the service file a bit (see comments in provided service file). | ||
|
||
Now you should be able to run `systemctl restart reactionrolebot.service` to | ||
start your bot. |
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,31 @@ | ||
# Migrating your instance to 2.x | ||
|
||
This guide is for people who were running their own 1.x instance of the bot. | ||
|
||
This bot now runs Discord.js v13, which requires Node.js 16.6.0. On some | ||
platforms (older distros, cloud hosting, etc...) this may be problematic. | ||
Something like https://github.com/nvm-sh/nvm can make the transition easier. | ||
|
||
1. Get the updated bot code (either `git pull origin master` if you cloned with | ||
git (which you should) or download `master` as a zip). | ||
1. Make a copy of your old database | ||
- **Running as a service**: probably `/srv/discord/rolebot.sqlite3` | ||
- **Running in dev-mode**: `dev.sqlite3` | ||
1. Replace bot token file with a `config.json` file that looks like this: | ||
```json | ||
{ | ||
"token": "<your token here>", | ||
"app_id": "<your bot application ID here>" | ||
} | ||
``` | ||
- **Running as a service**: Replace `/etc/discord/ReactionRoleBot/token` | ||
with `/etc/discord/ReactionRoleBot/config.json` | ||
- **Running in dev-mode**: Some local token file | ||
1. Install updated dependencies: `npm ci` | ||
1. Register slash commands: `npm run register path/to/your/config.json` | ||
1. Update your database: `npm run knex migrate:latest` | ||
1. Start the bot | ||
- **Running as a service**: update `reactionrolebot.service` ([see reference | ||
implementation](../resources/reactionrolebot.service)). Restart service | ||
`systemctl restart reactionrolebot.service`. | ||
- **Running in dev-mode**: `npm start path/to/your/config.json` |
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