Skip to content
Discord bot to add/remove roles based on user activity
TypeScript Dockerfile JavaScript
Branch: master
Clone or download
Latest commit 655822f Aug 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.buildkite Add publish pipeline, add Docker image build to regular pipeline Aug 23, 2019
.vscode Update project configurations Aug 5, 2019
docs Add readme, add privacy and terms doc May 28, 2019
src Add guildId and memberId to events missing them Aug 8, 2019
.editorconfig Initialise tools Apr 4, 2019
.gitignore Update included config sample filename Aug 21, 2019
CHANGELOG.md Update readme, changelog, package.json Aug 24, 2019
Dockerfile Add publish pipeline, add Docker image build to regular pipeline Aug 23, 2019
LICENSE Initialise tools Apr 4, 2019
README.md Update readme, changelog, package.json Aug 24, 2019
_config.yml Add readme, add privacy and terms doc May 28, 2019
config.sample.json Update included config sample filename Aug 21, 2019
package-lock.json Add config Disharmony config extension with culling interval option Aug 7, 2019
package.json
test-runner.js Update project configurations Aug 5, 2019
tsconfig.json Add unit tests for ActivityRegisterer Aug 7, 2019
tsconfig.prod.json Update project configurations Aug 5, 2019
tslint.json Update project configurations Aug 5, 2019

README.md

Build status Health status

Discord Activity Monitor

A Discord bot to assign/remove a role from users in your guild based on whether or not they have been active lately

Features

  • Remove an 'active' role from a user who has not been active for a number of days
  • Optionally assign an 'inactive' role to a user when they lose the 'active' role
  • Optionally re-assign the 'active' role when a user who becomes active again
  • Configure specific users or roles to be exempt from monitoring
  • Configure threshold for inactivity

Use cases

  • Keep active members at the top of the members sidebar
  • Reward active members for participating in the community
  • Recognise how many inactive members your server has

Getting started

Invite

Setup

Admin only Setup requires administrator permission in the Discord server

  1. Create a role (or choose an existing one) to use to mark active users
  2. Make your chosen role mentionable (only needed until setup is complete)
  3. Put the bot's role higher in the list than your chosen role
  4. Run @Activity Monitor setup in a channel the bot can read and write in
    • If you've nicknamed the bot, substitute @Activity Monitor for it's nickname
  5. Respond with the information the bot asks you for, until setup is complete
  • You can view your guild settings with @Activity Monitor view-config

Example:
Example setup

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 people are active
Send messages Used to ask setup questions (can be disabled after setup is complete)
Manage roles Assign and remove the active role from users
Embed links Responses to 'help' requests use message embeds for nice formatting

Self hosting

Manually

  1. Install Node.js v10 and
  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-activity-monitor

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.