kaustav202 / Detective-Discord

A discord bot that can detect Nitro Scam Links and delete them to protect other users. Add it to your server now.

Home Page:https://discord.com/api/oauth2/authorize?client_id=934344337171554314&permissions=1376537242626&scope=bot%20applications.commands

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHub Socialify

💡 Bot's Innovation

Have you ever received messages like these?

                       

If you have been on Discord for a while, I am sure you have been warned to stay away from these links.
But the newcomers out there don't have any idea about these links and fall into such scams and lose access to their discord accounts.

⚙️ Tech Stack

Python Discord SQLite Wikipedia

💻 What exactly does it do?

Detective Discord is a bot that detects phishing links in discord messages, deletes them, warns the user who sent them, and increases their warning count by 1. Once the warning count hits 3, the user is kicked from the server and is also informed by the bot of the same.

kicked message Member Kicked

If the bot is unable to delete the message due to missing permissions (not every server admin allows the bot to delete server messages), it replies to the message -

image

This way, it alerts the members of the server and keeps them safe, until the Moderators eventually delete the message.

🤖 BOT ACTIONS :

  • /weather - Returns the weather of a city

weather

  • /wiki - Returns a Wikipedia summary

wiki

  • /news - Returns the top 5 news from BBC

news

  • /joke - Returns a random joke

joke

  • /dadjoke - Returns a dad joke

dadjoke

  • /avatar - Returns mentioned user's Avatar

avatar

  • /help - Returns all the commands that the bot supports

Admin / Mod commands

  • /reset_warn - Reset warnings for a member

reset_warn

  • /safe_domain - Add a domain to the safe domains list

image

  • /unsafe_domain - Remove a domain from the safe domains list

image

⚙️ Logic for Phishing Link Detection

The rules to detect phishing links are quite simple:

  • Check if the message includes any links. If not, simply return false.
  • Check if the link is not included in the safe domains list (stored in domains.db). Current links include discord.gift, discord.com, discord.gg, discord.me, discord.io, discordapp.com.
  • Calculate the Levenshtein distance between the message link and the real discord links.
  • If the distance is less than 5, the link is considered to be a dangerous link, return true otherwise false.

For fetching the News, the bot uses the BBC API.
For fetching the weather, the bot uses the OpenWeatherMap API.
For fetching the jokes, the bot uses the pyjokes python library.
For fetching the Wikipedia summary, the bot uses the Wikipedia python library.

Install and Run Locally

  • Python installation is required (contact if help is needed)
  • Clone the repository
  • Navigate to the project directory cd Detective-Discord
  • Create a virtual environment and activate it (optional) (creation: python/python3 -m venv env)
  • Install the required libraries pip install -r requirements.txt
  • Create a .env file and add your discord bot TOKEN. Adding NEWS_API, WEATHER_API KEYS is optional. Remember to remove their commands if you wish to not include them.
  • Run the bot using the command python3 bot.py

Steps to contribute:

  • Drop a ⭐ on the Github repository (optional)
  • Search for an issue on the repo which you can contribute to and get it assigned to you. (You can also Open New Issues)
  • You can also make non-tech contributions by improving the readme or contribution guidelines files.
  • Refer to Contribution Guidelines for a detailed contribution guide.

Contributors

❤️ Project Admin

Kanak Mittal

About

A discord bot that can detect Nitro Scam Links and delete them to protect other users. Add it to your server now.

https://discord.com/api/oauth2/authorize?client_id=934344337171554314&permissions=1376537242626&scope=bot%20applications.commands

License:MIT License


Languages

Language:Python 100.0%