Skip to content

Commit

Permalink
Merge pull request #70 from Mimickal/ts-port
Browse files Browse the repository at this point in the history
  • Loading branch information
Mimickal authored Sep 30, 2023
2 parents 129fdc4 + 5af279a commit 1c30d64
Show file tree
Hide file tree
Showing 23 changed files with 2,179 additions and 4,574 deletions.
2 changes: 1 addition & 1 deletion .replit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
language = "nodejs"
run = "node ."
run = "npm run start"
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
worker: node .
worker: npm run start
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ src="https://www.gnu.org/graphics/agplv3-155x51.png">
A Discord bot that can assign roles based on message reactions.<br/>
[You can invite my live instance of the bot to your server with this link](
https://discord.com/oauth2/authorize?client_id=692585944934514738&scope=applications.commands%20bot&permissions=335881280
).
).<br/>
[Join the support server here](https://discord.gg/7UBT8SK).

# Why this bot?
Several other popular role-react bots exist, but many of them have some annoying
Expand Down Expand Up @@ -41,7 +42,7 @@ the channel with your role-react post, and have have following permissions:
* **Manage roles** - To assign roles to users
* **Read Message History** - To see posts in the channel before it joined
* **Use External Emojis** - To use your custom emojis in role reacts
* **Read Text Channels & See Voice Channels** - To see the role-react post
* **View Channels** - To see the role-react post

**Note:** These permissions may be inherited from your `@everyone` settings.

Expand Down Expand Up @@ -134,9 +135,12 @@ won't do anything, but you *could* do it...
## Hosting your own instance
[See the guide here](docs/hosting.md).

If you are upgrading from version 1.x, [see the migration guide](
If you are upgrading from version 1.x to 2.x, [follow this migration guide](
docs/migrate.md).

If you are upgrading from version 2.x to 3.x, [follow this migration guide](
docs/migrate3.md).

## License
Copyright 2020 [Mimickal](https://github.com/Mimickal)

Expand Down
4 changes: 2 additions & 2 deletions docs/hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ 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
npm run register -- --config /etc/discord/ReactionRoleBot/config.json src/commands.ts
NODE_ENV=prod npm run knex migrate:latest
```

Expand All @@ -86,7 +86,7 @@ start your bot.

- **database_file** - Use a different SQLite3 database file. This defaults to `/srv/discord/rolebot.sqlite3`. Users on non-Linux systems will probably want to change this.
- **enable_precache** - Makes the bot pre-cache all messages with reaction roles on startup. This can help the bot be more consistent when it first starts, but will cause larger bots to be rate limited. Use with caution!
- **guild_id** - Limits slash command registration to this Guild. This is useful for bot development.
- **guild** - Limits slash command registration to this Guild. This is useful for bot development.
- **log_file** - Use a different log file. This defaults to `output.log` in the project root.

You can also run the bot with a config file other than `config.json`, but you must provide an absolute file path!
Expand Down
26 changes: 26 additions & 0 deletions docs/migrate3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Migrating your instance to 3.x

This guide is for people who were running their own 2.x instance of the bot.

This bot now runs Discord.js v14, which requires Node.js 16.11.0 or later.
Something like [`nvm`](https://github.com/nvm-sh/nvm) can make the transition
easier.

This bot is also now written in TypeScript and runs natively using `ts-node`.
We do not transpile down to JavaScript! For hosting the bot, the only thing this
should affect is the install size (2.0 was ~64 MB, 3.0 is ~114 MB).

1. Get the updated bot code. Either:
- `git pull origin master` if you cloned with git (which you should).
- Download the `master` branch from GitHub as a zip file, and extract it.
1. In your `config.json`:
- Rename `app_id` to `app`.
- Rename `guild_id` to `guild` (if you have it).
1. Install updated dependencies: `npm ci`.
1. You may need / want to update your `reactionrolebot.service` definition.
- Added instructions on how to run as a user service.
- Changed `WantedBy` to be `default.target` instead of `multi-user.target`.
- Removed `User` field in favor of running as a user service.
1. Restart the bot.
- **Running as a service**: `systemctl restart reactionrolebot.service`
- **Running in dev-mode**: `npm start path/to/your/config.json`
Loading

0 comments on commit 1c30d64

Please sign in to comment.