A simple Discord bot that keeps your server safe and secure. Built using Pangea & Discord.py for the Hashnode x Pangea Hackathon by Hashnode.
2023-11-16.02-07-28.mp4
- Auto Redact - Automatically redacts messages that contain profanity/private information like emails, phone numbers, credit card numbers, etc.
- Auto URL Scan - Automatically scans URLs present in messages for malicious content and deletes it if a malicious URL is found.
- Auto File Scan - Automatically scans files uploaded to the server for malicious content and deletes it if a malicious file is found.
- Logging - Logs reports of malicious content found in messages, URLs, and files to a channel in the server for you to review.
-
Sign up for Pangea and enable Redact, URL Intel, and File Scan.
-
Get the API keys for each of the above mentioned services and add them to your
.env
file.
REDACT_TOKEN=your_redact_token
FILESCAN_TOKEN=your_filescan_token
PANGEA_DOMAIN=your_pangea_domain
URLSCAN_TOKEN=your_urlscan_token
- Head over to Discord Developer Portal and create a new application. Then, create a bot for the application and copy the client token and client ID. Make sure you enable all the gateway intents for the bot. Add these to your
.env
file.
BOT_TOKEN=your_bot_token
BOT_ID=your_bot_id
- Create a new account on Supabase and create a new project. Add the project URL and the public key to your
.env
file.
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
- Create a new table
logger
in your Supabase project using this query in the SQL editor.
create table
public.logger (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
guild_id bigint not null,
channel_id bigint null,
constraint logger_pkey primary key (guild_id)
) tablespace pg_default;
- Clone this repository and install the dependencies.
git clone https://github.com/asrvd/disguard.git
cd disguard
pip install -r requirements.txt
- Run the bot.
python bot.py
-
Head over to the Discord Developer Portal and select your application that you created earlier. Then, go to the OAuth2 tab -> URL Generator and select the
bot
scope. -
Scroll down and select the following permissions for the bot.
-
Copy the generated URL and paste it in your browser. Select the server you want to add the bot to and click on Authorize.
-
Create a new channel in your server and copy the channel ID. You can name it anything like
disguard-logs
. -
Run the following command in your server to set the log channel.
p.logger add <channel_id>
- To remove or update the log channel, run the following commands.
p.logger remove
p.logger update <channel_id>