Installation (continued)
Last updated
Last updated
To be able to store data such as logs, you will need to use your own database. A database is required, as the database also stores configuration data for your bot.
Modmail supports MongoDB and you are required to provide a MongoDB connection string to the bot. You can get a free 500MB cluster from MongoDB Atlas, which is enough to store around 3 million message logs.
Upon creating an account, you will be greeted with this page. Make sure you select Starter Cluster.
After this, you will be taken to the below screen:
Select one of the servers marked with FREE TIER AVAILABLE
and click on Create Cluster
. It will only take a couple of minutes to configure everything for you.
Follow the "Getting Started" tutorial on the bottom left.
Go to the Database Access
section in the security
tab. Click on + Add New User
to create a new user, whereupon a new screen will pop up. Select Read and write to any database
, so the bot can properly store the data. Choose a username and password, but make sure they both don't contain any special character like !
, -
, ?
. Copy the password into your notepad.
Finally, click Add User
to finish the creation.
Go to the Network Access
section in the security
tab. Click on + Add IP Address
to add an IP address, whereupon a new screen will pop up. Click the Allow Access From Everywhere
button and 0.0.0.0/0
should appear in the Whitelist Entry
. Otherwise, make sure to put input that manually. Finally, click Confirm
to confirm your changes.
The last part is to generate a Mongo URI. Go to the Clusters
section in the Atlas
tab. Click on Connect
on the left side of your Cluster dashboard. This will open up a new screen where you have three options. For our purposes, select the middle option Connect Your Application
.
You need to copy the connection string, which can be easily done by clicking the Copy
button. Remove everything past <dbname>
but keeping the /
. Then replace <password>
with the password for your user and <username>
with your database-username, which you set earlier. Paste the URI in your notepad.
The final URI looks similar to this: mongodb+srv://Username:MyPassword@modmail-kjvn21.mongodb.net/
.
github_token
( Required for the update command )Note: This is not required when you are hosting using a vps.
Generate a new token
If those steps are done correctly you can use the ?update
command to update your bot to the latest version!
This is not the bot!
You will need to deploy a separate log viewer application from this repository. This Heroku application is separate from the bot; it's a simple website that will be used to display your thread logs.
Choose a name for your app and paste your Mongo URI (from your notepad). After you click the Deploy App
button, it will start creating the website.
After that's done configuring, click the View
button. It will redirect you to the logviewer home screen. Copy the link in the address bar and paste it in Notepad.
This is the second application you will be deploying
6.1. Choose any name for your app. Note: this name doesn't matter at all.
6.2. Put your bot's token in the TOKEN
field.
6.3. In the DATABASE_TYPE
You may fillout: mongodb
6.4. Put the ID of your Server into the GUILD_ID
field.
6.5. Put your own ID in the OWNERS
field. If there are multiple owners, separate them by a comma: 180314310298304512, 355790471219511297, 325012556940836864
.
6.6. Put your Mongo connection URI from the previous section in the CONNECTION_URI
field.
6.7. Put the github token
you just created in the GITHUB_TOKEN
field.
6.8. Put the URL of your log viewer Heroku app (https://yourlogviewerappname.herokuapp.com
) in the LOG_URL
field.
6.9. Click the deploy app
button and wait for it to finish.
6.10. Click Manage App
and go into the Resources
tab, where you need to turn on the worker by clicking the pencil icon next to it.
6.11. If you want, you can go over and check the application logs to see if everything is running smoothly. If any unexpected errors pop up, join our Discord server and DM Modmail. The support members will help you figure out the issue and show you how to fix it.
6.12. Once the bot is online in your server, make sure to give it Manage Channels
, Manage Messages
and View Audit Logs
permissions. If your bot is not online, recheck the previous steps above.
6.13. Do the ?setup
command and you are good to go!
Congratulations! Your bot is ready! Head over to Discord and try it out! If you have any issues or questions, join the Discord server.
Make sure to setup permissions using this handy guide!
Taki's Blog contains many cool customizations for the bot, so you might want to check it out!
If you like the bot, consider giving this repository a star 😉. If you want to support the developers financially, subscribe to the Patreon.
Start off by going to your Github personal access tokens
Click on the Generate new token button in the top right of the view.
Give the token a name, such as: modmail github_token
. Then check the repo
scope.
Click Generate token
and GitHub will take you back to the list of tokens from before. Copy the code into your clipboard.