Simple ModMail Discord bot designed for a small server and people that want to maintain their own ModMail bot in discord. ModMail is a bot that create a private space between moderator and user to address an issue by acting as a bridge between user DM channel and new temporary channel inside a thread server.
This bot only support one pair of server per bot, one main server and one thread server. I'm debugging the bot alone so expect some bugs passed to GitHub, and if you encounter bugs report here.
This is a complete rewrite of previous version. This version of the bot use Replit nix to meet node version requirement for Discord.Js v13 to host it in Replit and it's still in beta version. This bot use slash command and currently can't receive file attachment as an input due Discord API limitation. It's still a planned feature for slash command option as stated in this link. Global slash commands need up to an hour to register properly.
v16.6.0
or higherv7.0.0
or higherPrivileged Gateway Intents
section and turn on Server Members Intent
.bot
, application.commands
.Manage Roles
, Manage Channels
, Read Messages/View Channels
, Send Messages
, Embed Links
, Attach Files
, Read Message History
, Mention Everyone
If you don't understand Discord permissions rules, either give the bot
Administrator
permission or read this guide.You'll need to re-invite the bot with correct scopes if you get "Missing Access" error.
.env
file and paste your bot token right after the equal sign on TOKEN=
and save the file. e.g. TOKEN=YourBotTokenHere
defaultConfig.json
file and paste your discord user id inside double quotes ""
character that are after "ownerID":
and save the file. e.g. "ownerID": "YourUserIdHere"
Setting ownerID is recommend since it'll limit who can use critical commands.
+ Create Repl
button.Nix (beta)
as template, and then click + Create Repl
.Files
pane on Replit and click replace
.ctrl
+shift
+s
) and run npm install
command.Run
button at the top of Replit page and your bot should be online.ReplDB show an error when used outside Replit. Follow this instruction to change the database.
DB.js
file from functions
folder, comment ReplDB section and uncomment Sequelize section.package.json
file.sequelize-package.json
file to package.json
.npm install
command.npm start
command from the terminal.setup
message to start bot setup and reply to the bot message to proceed. e.g. @ModMail setup
If you have Replit Hacker Plan, turn your Replit project to always on and ignore this part of instruction.
You can also skip this part if you aren't hosting it on Replit.
+ Add New Monitor
button.HTTP(s)
for Monitor Type and fill the name section.URL
section. e.g. https://projectName.replUsername.repl.co
Create Monitor
button at the bottom.template.txt
and rename it to designated language name and change the file type to javascript .js
.""
with the translation while using en.js
as reference.
en.js
name: "en"
*Global Command
**Optional
Name | Operation | Description | Usage |
---|---|---|---|
/block | info | Show specified user information | /block operation:info target:userID |
list | Show blocked users list | /block operation:list page:number ** |
|
add | Block specified user | /block operation:add target:userID reason:blockReason |
|
set | Edit specified user blocking reason | /block operation:set target:userID reason:newReason |
|
remove | Remove specified user from blocked list | /block operation:remove target:userID |
|
/close | - | Close an active thread | /close reason:closeReason note:threadNote ** anon:true ** |
/config | view | Show current bot configuration | /config operation:view |
info | Show specified config information | /config operation:info target:configName |
|
set | Edit specified config value | /config operation:set target:configName value:newValue |
|
reset | Reset specified or all config value | /config operation:reset target:configName |
|
/create* | - | Create new thread | /create title:threadTitle |
/help* | - | Show specified command information | /help target:commandName |
/ping | - | Calculate bot latency | /ping |
/reply* | - | Reply an active thread | /reply content:message anon:true |
/tag | view | Show a saved response | /tag operation:view target:tagName show:true ** |
sent | Sent a saved response to an active thread | /tag operation:sent target:tagName |
|
info | Show tag information | /tag operation:info target:tagName |
|
list | Show tag list | /tag operation:list page:number |
|
add | Create new saved response | /tag operation:add target:tagName content:tagContent |
|
set | Edit a saved response content | /tag operation:set target:tagName content:newContent |
|
remove | Remove specified tag | /tag operation:remove target:tagName |
|
/thread | info | Show specified thread information | /thread operation:info user:targetUser |
/thread operation:info channel:targetChannel |
|||
list | Show thread list | /thread operation:list page:number ** |
|
bind | Bind a user thread to a channel | /thread operation:bind user:targetUser channel:targetChannel title:threadTitle ** |
If
ownerID
are set, only owner can use these commands.⚠️ If
ownerID
are empty butmainServerID
orthreadServerID
are set, only admin from those servers can use these commands.⚠️ If
ownerID
,mainServerID
, andthreadServerID
are empty, any admin from any server can use these commands.
Name | Description | Usage |
---|---|---|
config | Show current bot config | @ModMail config |
deploy | Deploy slash commands | @ModMail deploy |
guilds | Show list of guilds(servers) the bot in | @ModMail guilds |
leave | Leave specified guild(server) | @ModMail leave guildID |
reload | Reload specified command, function, or locale file | @ModMail reload targetName |
reset | Reset all or specified config value | @ModMail reset all |
@ModMail reset configName | ||
set | Edit specified config value | @ModMail set configName configValue |
setup | Set required bot config and deploy slash command | @ModMail setup |
I made Discord server to test the bot, feel free to join at https://discord.gg/bzG7AqcRyC.