2017-02-10 00:19:14 -05:00
# Modmail for Discord
A bot for [Discord ](https://discordapp.com/ ) that allows users to DM the bot to contact the server's entire mod team.
These DMs get relayed to a modmail server where each user gets their own channel, or "thread".
Moderators and admins can then reply to these threads, and these responses are relayed back to the original user as a DM.
Inspired by Reddit's modmail system.
2018-02-24 06:09:07 -05:00
### NOTE! If you're upgrading from a version prior to Feb 24 2018:
* Take backups
* Run `npm install` again
* Follow the on-screen instructions after `npm start`
2018-02-18 13:06:40 -05:00
2017-02-10 00:19:14 -05:00
## Setup
2018-02-24 06:09:07 -05:00
1. Install Node.js 8.9.4 (LTS) or higher
2017-02-10 00:19:14 -05:00
2. Clone or download this repository
3. Create a Discord server to be used as the modmail inbox
2017-06-14 03:12:19 -04:00
4. Make a copy of the file `config.example.json` in the same folder and name the copy `config.json` . Open the file and fill in the values.
2017-09-22 15:46:18 -04:00
- You can also find more configurable options at the end of this page!
2017-02-10 00:47:10 -05:00
5. Install dependencies: `npm install`
2017-05-01 05:14:28 -04:00
6. Add bot to servers, and make sure to give it proper permissions on the mail server.
2017-07-23 19:46:55 -04:00
7. Run the bot: `npm start`
2017-02-10 00:19:14 -05:00
2018-02-18 13:06:40 -05:00
## Changelog
See [CHANGELOG.md ](CHANGELOG.md )
2017-02-10 00:19:14 -05:00
## Commands
##### Anywhere on the modmail inbox server
`!logs <user>` Lists previous modmail logs with the specified user
`!block <user>` Blocks the specified user from using modmail
2017-07-23 20:37:40 -04:00
`!unblock <user>` Unblocks the specified user from using modmail
2017-07-23 20:56:08 -04:00
`!s <shortcut> <text>` Adds a snippet (a canned response). See below for how to use it.
`!edit_snippet <shortcut> <text>` Edits an existing snippet (alias `!es` )
`!delete_snippet <shortcut>` Deletes the specified snippet (alias `!ds` )
`!snippets` Lists all available snippets
2017-02-10 00:19:14 -05:00
##### Inside a modmail thread
`!reply <text>` Sends a reply to the user in the format "(Role) User: text" (alias `!r` )
2017-05-01 18:04:14 -04:00
`!anonreply <text>` Sends an anonymous reply to the user in the format "Role: text" (alias `!ar` )
2017-02-10 00:19:14 -05:00
`!close` Closes the modmail thread and saves a log of it
`!logs` Lists previous modmail logs with this user
`!block` Blocks the user from using modmail
2017-07-23 20:37:40 -04:00
`!unblock` Unblocks the user from using modmail
2018-02-24 06:09:07 -05:00
`!!shortcut` Reply with a snippet. Replace `shortcut` with the snippet's actual shortcut.
2018-02-24 06:15:28 -05:00
`!move <category>` If `allowMove` is enabled, moves the thread channel to the specified category
`!loglink` Shows the link to the current thread's log
2017-05-01 05:14:28 -04:00
To automatically reply without using !reply or !r, enable `alwaysReply` in the config. `alwaysReplyAnon` sets whether to reply anonymously. If you do not wish to reply, it will ignore any message starting in the prefix (which defaults to !), such as !note
2017-05-17 23:04:20 -04:00
## Configuration options
These go in `config.json` . See also `config.example.json` .
|Option|Default|Description|
|------|-------|-----------|
|token|None|**Required!** The bot user's token|
|mailGuildId|None|**Required!** The inbox server's ID|
|mainGuildId|None|ID of the main server where people contact the bot from, used for e.g. displaying users' nicknames|
|prefix|"!"|Prefix for bot commands|
|status|"Message me for help"|The bot's "Playing" text|
|responseMessage|"Thank you for your message! Our mod team will reply to you here as soon as possible."|The bot's response to DMs that start a new thread|
|alwaysReply|false|If set to true, all messages in modmail threads will be relayed back to the user, even ones without `!r` |
|alwaysReplyAnon|false|If `alwaysReply` is set to true, this option controls whether the auto-reply is anonymous|
|useNicknames|false|If set to true, mod replies will use their nickname (on the inbox server) instead of their username|
|ignoreAccidentalThreads|false|If set to true, the bot attempts to ignore common "accidental" messages that would start a new thread, such as "ok", "thanks", etc.|
2018-01-22 17:17:24 -05:00
|typingProxy|false|If set to true, the bot will start typing in the corresponding modmail channel when the user starts typing in DM.
|typingProxyReverse|false|If set to true, the bot will start typing in the user's DM when someone starts typing in the corresponding thread.
2017-05-17 23:04:20 -04:00
|enableGreeting|false|Set to true to send a welcome message to new main guild members. Requires `mainGuildId` to be set.|
|greetingMessage|None|Text content of the welcome message|
|greetingAttachment|None|Path to an image or other attachment to send along with the greeting|
|port|8890|Port from which to serve attachments and logs|
|url|None|URL to use for attachment and log links. Defaults to `IP:PORT` |
2017-07-23 20:37:40 -04:00
|snippetPrefix|"!!"|Prefix to use snippets. Defaults to `prefix` x2.|
2017-08-03 14:51:33 -04:00
|inboxServerPermission|None|Permission required to use bot commands on the inbox server|
2017-09-19 10:38:37 -04:00
|logChannelId|Server's default channel|Channel where to post links to closed threads and other alerts|
2017-09-22 15:18:15 -04:00
|newThreadCategoryId|None|ID of the category where new modmail thread channels should be placed|
2018-02-18 13:06:40 -05:00
|relaySmallAttachmentsAsAttachments|false|Whether to relay small (< 2MB ) attachments from users as attachments rather than links in modmail threads |
2018-02-18 16:29:24 -05:00
|threadTimestamps|false|Whether to show custom timestamps in threads, in addition to Discord's own timestamps. Logs always have accurate timestamps, regardless of this setting.|
2018-02-24 16:19:19 -05:00
|typingProxy|false|If enabled, any time a user is typing to modmail in their DMs, the modmail thread will show the bot as "typing"|
|typingProxyReverse|false|If enabled, any time a moderator is typing in a modmail thread, the user will see the bot "typing" in their DMs|