This is a Discord bot that archives entire servers, storing every message in a SQLite database for easy querying.
-
Create a Discord bot in the Developer portal: https://discord.com/developers/applications.
-
Add the bot to your server using the generated OAUTH2 URL. Since I'm hosting it myself and using it on my server I'd just give it Administrator permissions. Otherwise, my best guess is that it needs to view and manage messages. For example: https://discord.com/oauth2/authorize?client_id=1016161382653247569&permissions=292057901056&integration_type=0&scope=bot
-
Install Python: https://www.python.org/downloads/
-
Clone the repo:
git clone https://github.com/TheNathanSpace/DiscordServerArchiver
cd DiscordServerArchiver
- Install the Python dependencies:
pip install -r requirements.txt
- Define your bot's secret key in the variable
key
in the modulesecrets
:
key = "asdfasdgraha4535h5h3h5.25yhbas.5h23qaz6uaq35yraq3y35aq"
- Run the bot:
python bot.py
!update_archive
archives every message in the server, storing them in an SQLite database.
!count_reactions
queries the local database, counts how many times each user has used each reaction, and saves the
results as a .json
file.