Discord Digest
Your Discord server's most important Discord messages in email or web format.
Explore the docs »
Contribute
·
Report Bug
·
Request Feature
Table of Contents
About The Project
Discord moves fast, this project aims to help your community not miss the important stuff by compiling the most important / popular messages into json format for use in email templates, web pages, and more!
Built With
Getting Started
Prerequisites
- A Discord account
- A Discord server (guild)
- A developer account on the Discord Developer Portal (https://discord.com/developers/applications)
Create a virtual environment (I enjoy using pyenv-virtualenv)
- pyenv
pyenv virtualenv 3.10.x discord-digest-env
Section 1 - Creating the Bot
Steps
- Log in to the Discord Developer Portal and create a new application.
- Give your application a name and click "Create". We reccomend the name
ServerDigest-bot
. - In the application dashboard, navigate to the "Bot" section and click "Add Bot".
- Generate a TOKEN by clicking the "Reset Token" button. Copy the token and add it to your
.env
file at the root of your repo. Make sure to keep this a secret. - On the same "Bot" page, activate "Message Content Intent" button slider. Note: This setting is required for your bot to receive message content in most messages.
- Navigate to the OAuth2 tab and click URL Generator. On this page, select the "bot" scope and "administrator" bot permissions.
- Copy the Generated URL to be used in step 8.
- Navigate to General within the OAuth2 section, underneath the "Default Authorization Link" section, select "Custom URL" and paste URL from step 7. Click "Save Changes".
- Load this URL in a new tab and select which of your servers you want to install the bot in. Follow GUI instructions to Authorize.
- That's it! The bot is ready to be used by the codebase.
Section 2 - Enable Discord Developer Mode
- Open up the Discord app (Desktop or Web)
- Click on User Settings cog button
- Under the APP SETTINGS section click "Advanced"
- Toggle "Developer Mode" on
Section 3 - Setting up the Repo
-
Clone this repo
git clone https://github.com/skyforest/discord-digest.git
-
Activate the virtual environment you created from the Prerequistes section
-
Install Python packages
pip install -r requirements.txt
-
To get the guild ID of the guild you added your bot to, right click the guild icon on the left panel of discord and click "Copy ID". Add this value to your
.env
file. -
To get the channel ID, right click each channel name in Discord and click "Copy ID". Add the ID (or multiple ID's in list format) to your
.env
file in the format below. -
Configure the following environment variables in a local
.env
:DISCORD_TOKEN="PASTEYOURTOKENHERE" GUILD_ID=010101010101010101010101010101 CHANNEL_IDS=0000000000000,0000000000000000 COLLECTION_METHOD='COLLECT_MOST_REACTIONS'
NOTE: COLLECTION_METHOD can be set to one of the following: 'THREADS' 'CUSTOM_EMOJI' 'COMBO_THREADS_CUSTOM_EMOJI' 'COMBO_THREADS_MOST_REACTIONS' 'COLLECT_MOST_REACTIONS'
-
Add the Guild Role and ServerDigest Emoji by running the script once:
python app.py
Running this script for the first time, you will see the messages:
- "Custom role was not found - it has now been added. Mark your messages with the custom emoji and run again."
- "Custom emoji was not found - it has now been added. Mark your messages with the custom emoji and run again."
That's expected. Your Guild should now have a role called
serverdigest_admin
and the custom emoji:add_to_digest:
automatically added.
- Assign the
serverdigest_admin
role to any users who should have permission to mark messages with the ServerDigest emoji. The emoji will only become available for use to these specific users. (May require app to be reloaded for emoji to show up)
Section 4 (optional) - Sendgrid
- Sign up for Sendgrid
- Generate API key and copy/paste into your
.env
asSENDGRID_API_KEY=<YOUR_SENDGRID_API_KEY_HERE>
- Make sure
sendgrid
is installed via the requirements file OR runpip install stendgrid
Section 5 - Usage
Message Collection
-
Mark the messages you want to be collected with the custom
:add_to_digest:
emoji. Make sure the messages are inside of the channels you added to theCHANNEL_IDS
list within your.env
file. Messages will be collected from the past two weeks. -
cd
intocollector/
and run the message collection script:
python collector.py
If any messages from your Discord channels met the script criteria, they will appear in the messages.json
file.
Render Messages in Digest Template
-
Edit
digest/digest.py
and fill in the placeholder variablesDIGEST_NAME
DIGEST_BLURB
. -
cd
intodigest/
and run:
python digest.py
- Your newly generated digest html file will be available in
digest/digests/
. You can open that file in your browser to see how things look.
Send the digest as an email
-
Open and edit
mailroom/send_digest.py
and fill in the placeholder valuestarget_digest
,from_email
,to_emails
, andsubject
. -
cd
intomailroom/
and run:
python send_digest.py
Troubleshooting
Coming soon...
Roadmap
- Coming Soon...
See the open issues for a full list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Cody Antunez - Twitter: @skyforest - email: cody.antunez@gmail.com - Blog: codyantunez.com
Project Link: https://github.com/skyforest/discord-digest
Acknowledgments
Use this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!