Go to file
2022-11-29 19:18:48 +02:00
.github/workflows Create codeql-analysis.yml 2022-04-30 22:18:57 +03:00
logger linter pass 2022-01-12 18:29:14 +02:00
structure split string by whitespace (\s+) instead of ' ' 2022-11-29 19:18:37 +02:00
.dockerignore docker related stuff 2022-01-05 14:22:25 +02:00
.eslintrc.js linter pass 2021-10-22 10:35:04 +03:00
.gitignore linter pass 2021-10-22 10:35:04 +03:00
config.example.js configurable inline response 2022-01-27 15:01:41 +02:00
Dockerfile fixed a couple brainfarts 2022-01-05 16:20:49 +02:00
index.js fixed a couple brainfarts 2022-01-05 16:20:49 +02:00
LICENSE Create LICENSE 2021-06-20 00:07:21 +03:00
package.json Bump moment from 2.29.2 to 2.29.4 2022-11-21 21:20:17 +00:00
README.md docker related stuff 2022-01-05 14:22:25 +02:00
yarn.lock Bump moment from 2.29.2 to 2.29.4 2022-11-21 21:20:17 +00:00

WIP MODMAIL BOT

Still a work in progress, has no actual integration with the main bot at this point due to the main bot still being very much a work in progress.

Uses json for storage. If this is a problem, feel free to start a branch and write your own cache handler, alternatively use another bot. Shouldn't require much setup, fill in the relevant fields in config.js, should be well commented.

I've tried refactoring some of the original code that I wrote initially in haste, but a lot of it's still very questionable and in need of rewriting/refactoring. Contributions welcome.

Docker image

Highly recommend making a named volume for the storage

Create a named volume docker volume create ModmailStorage Make sure to have a config.js ready to go, see the example file for a template Start the container

docker run -d --name modmail \
-v /path/to/config.js:/modmail/config.js \
-v ModmailStorage:/modmail/modmail_cache \
navydotgif/modmail:latest

How to use

Install Node.js, at least v12, though I'd recommend at least 14 due to Discord.js requiring it in v13.

Run git clone https://github.com/GalacticBot/modmail.git

Run yarn install, alternatively npm install if you don't have yarn for some reason.

Rename config.example.js to config.js, open it and fill in the relevant values. The comments should explain what they are for. If something is unclear open an issue and I'll attempt to make it more clear.

At this point you'll probably notice you need to add 3 new categories. I'm planning on automating a part of the setup process, but for now this is how it be. Make those, add their IDs to the array.

I'd recommend getting PM2 or whatever you prefer for process management. Start up the bot and if you did everything right it should boot up and just work. If something goes wrong submit an issue, alternatively if you know how to fix it, issue a pull request.

Commands

!reply - Sends a reply to the user.
!cannedreply - Sends a pre-written reply to the user.
Both of these can be used with !r and !cr respectively and both of them support the anon keyword to send an anonymous reply. The anon keyword has to be the first argument.
!modmail <user> <content> or !mm <user> <content> - Sends a modmail to a user, also supports the anon keyword. !mm anon @navy.gif#1998 Some content that is sent anonymously
!markread [user|channel] - Marks the thread read and moves the channel to the read category indicating that the mail doesn't warrant a response. Messages you've replied to are automatically marked read.
!markunread [user|channel] - Marks the thread unread.
!mmlogs <user> [page] - Shows user's past modmail.
!mmqueue - Shows users in queue.
!id [channel] - Get the target user ID for the modmail thread. Can be used without the channel argument in a modmail channel, outside of a modmail channel will return the user ID for the channel's target if available.

The bot has an !eval command which you can grant access to in the config file.

Creating canned/pre-written replies
Simple as using !cr create <name> <the reply content here>. Updating an existing entry is done by overwriting it.
To delete one, use !cr delete <name>

TODO LIST

Commands

  • !markunread - Marks a thread unread Added, works similar to !markread, both from a channel and with a channel/user argument
  • !refresh- Refresh threads (recreate channels and repopulate them if the channel was hidden/deleted due to overflow)
  • !reload - Unsure if needed, putting here just in case. Would restart the bot when ran.

Other

  • Display more specific information instead of just "User is in banland" (should reflect whether user is actually banned or otherwise in the appeals server.
  • Add something to display character count for messages, either command or an option to toggle.
  • Allow arbitrary order of anon and user arguments for !modmail command.