Skip to content
Discord bot to allow users to join and leave configured roles using commands
TypeScript Dockerfile JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.buildkite Add GitHub release creation to publish pipeline Aug 23, 2019
.vscode Update project configuration etc for consistency Aug 18, 2019
docs
src
.editorconfig Initialise various Sep 30, 2018
.gitignore
CHANGELOG.md
Dockerfile Add Dockerfile + add Docker image build to pipeline Aug 22, 2019
LICENSE
README.md
_config.yml Set theme jekyll-theme-slate May 19, 2019
config.sample.json Update project configuration etc for consistency Aug 18, 2019
package-lock.json v4.0.1 Aug 28, 2019
package.json
test-runner.js
tsconfig.json Update project configuration etc for consistency Aug 18, 2019
tsconfig.prod.json Update project configuration etc for consistency Aug 18, 2019
tslint.json Update project configuration etc for consistency Aug 18, 2019

README.md

Build status Health status

Discord Role Assigner

A simple Discord bot to allow users to join and leave configured roles

Features

  • Toggle permissions for a role on and off
  • Simple command allows user to join and leave permitted roles

Use cases

  • You want certain roles to be opt-in, but don't want to have to manually assign users
  • Opt-in channels accessible by a joinable role
  • Opt-in role ping notifications accessible by a joinable role

Getting started

Invite

Setup

Use @RSS Poster help to view available commands

Admin only
These command requires administrator permission in the Discord server

  • @Role Assigner set-joinable <rolename> <true/false> to set or unset a role as joinable

Usage

These commands can be run by any user in the Discord server

  • @Role Assigner joinrole <rolename> to join a role
  • @Role Assigner leaverole <rolename> to leave a role

Permissions

The bot requires certain permissions, which you are prompted for on the invite screen. Each permission has a reason for being required, explained below.

Permission Reason
Read messsages Detect when a command is used
Send messages Confirmation that the command was successful
Manage roles Assign and remove roles to/from a user when they use the commands
Embed links Responses to 'help' requests use message embeds for nice formatting
Manage server Read server invites for role assigning when user joins with invite

Self hosting

Manually

  1. Install Node.js v10
  2. Clone the repository, or download and extract the zip file (preferrably from the release page)
  3. Create a new file config.json from a copy of config.sample.json; paste your bot token in the token field (between the quotes)
  4. Run npm run full-start to compile and run the bot
    • If you see yellow 'WARN' messages about peer dependencies, you can safely ignore these

Git users

If you cloned the repository with git, make sure you git reset --hard vX.Y to a specific version, as latest master isn't always production ready!

Docker

docker run [OPTIONS] benji7425/discord-role-assigner

Options

  • To gain access to the log files
    -v /path/to/logs:/app/logs
  • To provide a token (for the default configuration)
    -e TOKEN="your-token-here"
  • To maintain a persistent copy of the local database (for the default configuration)
    -v /path/to/data:/app/nedb-data
  • To provide your own configuration
    -v /path/to/config.json:/app/config.json

Notes

  • Due to limitations with volume mounting cross-OS you cannost use a Windows host with the inbuilt NeDB database
  • View the image on Docker Hub here

Database

  • Out of the box the project uses NeDB as a local database, storing the data in ./nedb-data
  • Both NeDB and MongoDB are supported
  • Edit the connection string in config.json or by setting the DB_STRING environment variable

Need help?

I am available for contact via my support Discord server. I will always do my best to respond, however I am often busy so can't always be available right away, and as this is a free service I may not always be able to resolve your query.

Built With

Versioning

SemVer is used for versioning; view available versions on the tags page

License

This project is licensed under the MIT License - see the LICENSE file for details

You can’t perform that action at this time.