- To get started with contributing to this project check out Steps to Contribute.
- To set-up the project locally check out Install and Run Locally
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.
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.
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 -
This way, it alerts the members of the server and keeps them safe, until the Moderators eventually delete the message.
/weather
- Returns the weather of a city
/wiki
- Returns a Wikipedia summary
/news
- Returns the top 5 news from BBC
/joke
- Returns a random joke
/dadjoke
- Returns a dad joke
/avatar
- Returns mentioned user's Avatar
/help
- Returns all the commands that the bot supports
/reset_warn
- Reset warnings for a member
/safe_domain
- Add a domain to the safe domains list
/unsafe_domain
- Remove a domain from the safe domains list
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.
- 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
- 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.
Kanak Mittal |