Skip to content

asrvd/disecure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disecure

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

Stack

Features

  • 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.

Usage

  1. Sign up for Pangea and enable Redact, URL Intel, and File Scan. Alt text

  2. 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
  1. 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
  1. 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
  1. 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;
  1. Clone this repository and install the dependencies.
git clone https://github.com/asrvd/disguard.git
cd disguard
pip install -r requirements.txt
  1. Run the bot.
python bot.py

Adding the bot to your server

  1. 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. oauth2

  2. Scroll down and select the following permissions for the bot. permissions

  3. Copy the generated URL and paste it in your browser. Select the server you want to add the bot to and click on Authorize.

Adding a log channel

  1. Create a new channel in your server and copy the channel ID. You can name it anything like disguard-logs.

  2. Run the following command in your server to set the log channel.

p.logger add <channel_id>
  1. To remove or update the log channel, run the following commands.
p.logger remove
p.logger update <channel_id>

Resources

About

a discord bot that keeps your server safe and secure made for the Hashnode x Pangea hackathon.

Resources

License

Stars

Watchers

Forks

Languages