A Python script used to scrape Discord guild info, roles, and channel overwrites.
- Git - Install Git
- Check if you have Git installed with
git --version
- Check if you have Git installed with
- Python (>=3.11; <4) - Install Python (Windows), Install Python (Linux) (see pyenv)
- Check if you have Python installed with
python3 --version
- Check if you have Python installed with
- Pip - Install Pip
- Check if you have Pip installed with
pip --version
- Check if you have Pip installed with
- Poetry - Install Poetry (preferrably with pipx)
- Check if you have Poetry installed with
poetry --version
- Check if you have Poetry installed with
- PyInstaller - Install PyInstaller (preferrably with pipx)
- Check if you have PyInstaller installed with
pyinstaller --version
- PyInstaller is platform dependent, if you want to build .exe files, you must build on Windows
- Check if you have PyInstaller installed with
- Act - Install Act
- Check if you have Act installed with
act --version
- Refer to this project's Makefile (
sudo-act
) for usage - Put secrets in workflow.secrets (
mv workflow.secrets.example workflow.secrets
)
- Check if you have Act installed with
- Markdownlint - Install Markdownlint
git clone https://github.com/vile/discord-role-scraper.git
cd discord-role-scraper
make
See CLI Args for more info.
poetry run python3 main.py (discord token) (server id) (single run)
After starting the script, follow the prompts given to input your token and server ID.
Download the latest windows-release.zip
file from the releases tab.
Then, unzip with your choice of zip tool (WinRAR, 7zip, NanaZip, etc.), and double click DiscordRoleScraper.exe
.
The releases includes the most up to date build and default config.toml
file.
Download the latest version of this repo via HTTPS or clone with git:
Or clone:
git clone https://github.com/vile/discord-role-scraper.git
cd discord-role-scraper
Install dependencies:
pip install -r requirements.txt
Then, run the script with Python in CMD/Powershell/Terminal:
python3 main.py
Ensure you have PyInstaller installed (see build requirements), install script dependencies, then build:
pip install -r requirements.txt
pyinstaller main.py --onefile --name DiscordRoleScraper
The built exe will be exported to the dist/
folder, move the file into the root directory of the project (where config.toml
is).
CLI args are supported both running directly with Python, and with a built exe. See CLI Args for more info.
python3 main.py (discord token) (server id) (single run)
.\DiscordRoleScraper.exe (discord token) (server id) (single run)
After starting the script, follow the prompts given to input your token and server ID.
The config.toml
file contains all of the editable settings for this script.
Any value under the permissions_to_scrape
section that starts with 0x
should be commented out instead of having its value changed.
The permission config can be expanded following Discord's bitwise permission flags.
Name | type | Default Value | Description |
---|---|---|---|
export_results | bool |
true |
Whether or not to export txt files of scrapes |
Name | type | Default Value | Description |
---|---|---|---|
scrape_guild_info | bool |
true |
Whether or not to scrape the guild's info |
Name | Default Value |
---|---|
id | true |
name | true |
icon | false |
description | true |
home_header | false |
splash | false |
discovery_splash | false |
features | false |
banner | false |
owner_id | true |
application_id | false |
region | true |
afk_channel_id | false |
afk_timeout | false |
system_channel_id | false |
system_channel_flags | false |
widget_enabled | false |
widget_channel_id | false |
verification_level | true |
Name | type | Default Value | Description |
---|---|---|---|
scrape_permission_info | bool |
true |
Whether or not to scrape the guild's roles and associated permissions and/or properties |
All values starting with 0x
can not be changed, if you wish to not see (disable) a specific permission in your scrapes, comment the line (using a #
). Changing any of the 0x
values will break calculations associated with checking permissions.
Name | Type | Default Value |
---|---|---|
name | bool |
true |
position | bool |
true |
id | bool |
true |
mentionable | bool |
true |
administrator | bitwise | |
mention all | bitwise | |
manage guild | bitwise | |
manage roles | bitwise | |
manage channels | bitwise | |
manage events | bitwise | |
manage nicknames | bitwise | |
kick members | bitwise | |
ban members | bitwise | |
webhooks | bitwise | |
app commands | bitwise | |
tags | bool |
true |
Name | type | Default Value | Description |
---|---|---|---|
scrape_channel_overwrite_info | bool |
false |
Whether or not to scrape the guild's channel overwrites, including both roles and users |
All CLI args are optional, but are sequentially required.
Meaning:
- if you want to pass
server id
, you must also passdiscord token
. - if you want to pass
single run
, you must also passserver id
anddiscord token
.
Supported args:
discord token
(full, unquoted auth token string)server id
(16 to 19 digit numeric server id)single run
(true/false, whether or not to immediately exit after the first scrape completes)- Automatically defaults to false
Arg types and defaults
All CLI args are unquoted.
Arg | Type | Default Value |
---|---|---|
discord token |
string | None |
server id |
int | 0 |
single run |
bool | false |
python3 main.py DISCORD.TOKEN.HERE
python3 main.py DISCORD.TOKEN.HERE SERVER_ID
python3 main.py DISCORD.TOKEN.HERE SERVER_ID true
Yes, your token is safe, it is only temporarily cached in memory for convience if you want to scrape multiple servers in the same session. After closing the script, your token is removed from memory. Your token is never saved on your computer, and is only ever sent to the official Discord API.
You're interacting with normally available API endpoints for user accounts in a normal way. However, Discord doesn't like when you script or automate any type of action, therefore there is always a risk of account termination. I am not responsible if you spam the API scraping servers and get your account terminated. It is recommended to use a brand new or alt account.
No, I will not help you with this script (follow the Linux and Windows sections above). No, I will not make you any scripts.
Make sure you've installed the script dependencies as well before building. PyInstaller does not automatically download packages/libraries for you, it only looks locally (either global installs or venv).