Configure Modmail and Logviewer
Last updated
Last updated
To be able to store data such as logs, you will need to use your own database.
Modmail supports MongoDB, and you are required to provide a MongoDB connection URI to the bot. You can get a free 500MB cluster from MongoDB Atlas. (Enough to store 3 million messages)
Upon creating an account, you will be greeted with this page:
Select one of the servers marked with "FREE TIER AVAILABLE" for the free option and click on "Create Cluster".
Follow the "Getting Started" tutorial on the bottom left, by creating a database user, whitelisting your IP, and connect to the cluster. When whitelisting you IP, be sure to select ALLOW ACCESS FROM ANYWHERE since Heroku does not grant a fixed IP.
Your IP should look something like this, with 0.0.0.0/0
:
This will show a URI under "Copy the SRV address:", copy that, and replace <PASSWORD>
with the database user password (not your account password). The final URI should look something like this:
If your URI is followed by test?retryWrites=true
or anything else, don't include it.
You will also need to deploy another separate log viewer application from this repo. Click on the deploy button over there and fill in the configurations upon request. This is a separate Heroku application from the bot and is a simple website that will be used to display your thread logs.
Star the repository before you start 😉
Input a name of your choice for your app, the Heroku app name is not important.
Input your bot token into the TOKEN
field.
Put the ID of your Server into the GUILD_ID
field.
Put your own ID in the OWNERS
field (if there are multiple owners, separate them by a comma: 123455,234567,456782
).
Input your MongoDB connection URI from the previous section into the MONGO_URI
field.
Input the URL of your log viewer Heroku app (https://yourlogviewerappname.herokuapp.com
) into the LOG_URL
field.
Click the deploy app
button and wait for it to finish.
Click Manage App
and go into the Resources
tab.
Now turn on the worker by clicking the pencil icon.
If you want, you can go over and check the application logs to see if everything is running smoothly.
Once the bot is online in your server, do [your prefix]setup
(defaults ?
) and you are good to go!
Your bot is ready! Head over to Discord and try it out! If you have any issues, join the Discord server.
Make sure to give the bot Manage Channels, Manage Messages and View Audit Logs permissions!
The last part is to generate a MongoDB URI, navigate to "Clusters" and click on "CONNECT" (as shown in "Getting Started"). From the popup, select the middle option "Connect Your Application", and then the first option "Short SRV connection string".