A discord bot that can detect Nitro Scam Links and delete them to protect other users

Overview

Detetective Discord

๐Ÿ’ก Inspiration

Have you ever recieved a message like this?

If you have been on Discord for a while, I am sure you have been warned to stay away from these links.
But what about the newbies that are just starting out?
One of such incidents happend this thursday on my server. A bunch of people fell victim to such phishing links.
There was no such bots available in the market to solve this problem so I decided to make it on my own.

๐Ÿ’ป What it does

Detective Discord is a bot that detects phishing links in Discord messages, deletes them, warns the user who sent them and increase thier warning count by 1. Once the warning count reaches 3, the user is banned from the server.
In case of a ban, the user is also informed by the bot for the same.

This bot can also perform a few other actions like:

  • $news - Get latest news from BBC
  • $weather - Get weather in a city
  • $joke - Get a random joke
  • $wiki - Get a summary of a search key from Wikipedia
  • $help - Get this message
  • $reset_warn - Reset warnings for a user (admin/moderator only)

โš™๏ธ How I built it

The rules to detect phishing links are simple:

  • Check if the message contains a link.
  • Check if the link is not exactly the same as the real discord links like discord.gg or discord.me.
  • Calculate the Levenstien Distance between the link and the real discord links.
  • If the distance is less than 4, or the message contains words like discord or nitro, the link is considered to be phishing link.

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.

โš™๏ธ Tech Stack

Python Discord SQLite Wikipedia

๐Ÿง  Challenges we ran into

At first, I thought it would be a really simple task but as I started to build it, I realized it wasn't that easy after all.
Firstly I had to make the rules to identify phishing links. But I also had to make sure that the bot would not delete the links that are not phishing links.
After hovering over various methods, I settled on using the Levenstien Distance algorithm.
After that, when testing the bot I realized that the bot would also delete the links that were not phishing links but other discord links.
So I had to tweak the rules and make them inclusive to the other links.
Finally, I had a hard time deleting the user from the database who sent the phishing links. There was a bug that I wasn't able to detect and it took me 1 whole hour to fix it.

๐Ÿ… Accomplishments that we're proud of

I am proud of the fact that I was able to build this bot in a day and that now my Server will no longer suffer from these phishing scams.

๐Ÿ“– What we learned

This is the first time I have build a discord bot. I learnd how to use the discord.py library and how to use the discord.py API.

๐Ÿš€ What's next for Detetective Discord

Setting a workflow to save the phishing links in the database and at the stroke of the midnight, report them through the appropriate channels.

Owner
Kanak Mittal
Data Scientist | B.Tech CSE Candidate | Competitive Coder | 6* @ Hackerrank (Problem Solving)
Kanak Mittal
Terraform module to ship CloudTrail logs stored in a S3 bucket into a Kinesis stream for further processing and real-time analysis.

AWS infrastructure to ship CloudTrail logs from S3 to Kinesis This repository contains a Terraform module to ship CloudTrail logs stored in a S3 bucke

Nexthink 8 Sep 20, 2022
Python API Client for Close

Close API A convenient Python wrapper for the Close API. API docs: http://developer.close.com Support: Close 56 Nov 30, 2022

โœ–๏ธ Unofficial API of 1337x.to

โœ–๏ธ Unofficial Python API Wrapper of 1337x This is the unofficial API of 1337x. It supports all proxies of 1337x and almost all functions of 1337x. You

Hemanta Pokharel 71 Dec 26, 2022
Weather App using openweathermap API

This is my hobby project used to learn how to use public api for project.In this i used the api of openweathermap to featch the weather details of various city across the globe by giving city name as

Subramanya K S 1 Nov 06, 2021
Telegram bot to trim and download videos from youtube.

Inline-YouTube-Trim-Bot Telegram bot to trim and download youtube videos Deploy You can deploy this bot anywhere. Demo - YouTubeBot Required Variables

SUBIN 56 Dec 11, 2022
A head unit UI designed to replace the RTx/SMEG/RNEG/NG4/RCC/NAC

HeadUnit UI (Come discuss about it on our Discord!) Intro This is the UI part of a headunit project from OpenLeo, based on python and kivy, it looks l

OpenLeo 6 Nov 23, 2022
Wetterdienst - Open weather data for humans

We are a group of like-minded people trying to make access to weather data in Python feel like a warm summer breeze, similar to other projects like rdwd for the R language, which originally drew our

226 Jan 04, 2023
A client library for the REST API of DocuWare's DMS

docuware-client This is a client library for the REST API of DocuWare DMS. Since DocuWare's documentation regarding the REST API is very sparse (at th

Stefan Schรถnberger 1 Feb 23, 2022
Automatically Message From Discord Account

Discord-AutoMessage A robust and versatile solution for automated social interactions HOW TO INSTALL Open cmd cd into your project directory Run the f

13 Jul 11, 2022
Discord Remote Administration Tool

Discord Remote Administration Tool

Rdimo 82 Aug 15, 2022
A napari plugin for visualising and interacting with electron cryotomograms

napari-subboxer A napari plugin for visualising and interacting with electron cryotomograms. Installation You can install napari-subboxer via pip: pip

3 Nov 25, 2021
A Bot to Upload files to Many Cloud services. Powered by Telethon.

oVo MultiUpload V1.0 ๐Ÿ‘€ A Bot to Upload files to Many Cloud services. Powered by Telethon _ ๐ŸŽฏ Follow me and star this repo for more telegram bots. @H

32 Dec 30, 2022
API para realizar parser de frases

NLP API Simple api to parse and apply some preprocessing steps in portuguses phrases (pt_BR) This api uses the great FastAPI and spaCy packages! Usage

โŸ  Rodolfo De Nadai 1 Dec 28, 2021
A telegram smoot and high quality music player bot.

โ–ช๏ธŽ Music Player โ–ช๏ธŽ A smooth telegram music bot with high quality songs โ–  [Features] โ€ข Fast Starts streaming your inputs while downloading and converti

Simple Boy 3 Feb 05, 2022
An iCal file to transport you to a new place every day until you die

everydayvirtualvacation An iCal file to transport you to a new place every day until you die The library is closed ๐Ÿ˜” ๐Ÿ˜” including a video of the plac

Jacob Chapman 33 Apr 19, 2022
Shuffle and add items from jellyfin to mpd (use in tandem with jellyfin-mopidy and mpd-mopidy). Similar to ncmpcpp's "Add random" feature..

jellyshuf Essentially implements ncmpcpp's add random feature (default hotkey: `) through a script which grabs info from jellyfin api itself. jellyfin

Ethan Djeric 2 Dec 14, 2021
Python Client for MLflow Tracking Server

Python Client for MLflow Python client for MLflow REST API. Features: Unlike MLflow Tracking client all REST API methods are exposed to user. All clas

MTS 35 Dec 23, 2022
AWS Blog post code for running feature-extraction on images using AWS Batch and Cloud Development Kit (CDK).

Batch processing with AWS Batch and CDK Welcome This repository demostrates provisioning the necessary infrastructure for running a job on AWS Batch u

AWS Samples 7 Oct 18, 2022
Useful tools for building interactions in Python

discord-interactions-python Types and helper functions for Discord Interactions webhooks. Installation Available via pypi: pip install discord-interac

Discord 77 Dec 07, 2022
A simple python bot that serves to send some notifications about GitHub events to Slack.

github alerts slack bot ๐Ÿค– What is it? ๐Ÿ” This is a simple bot that serves to send some notifications about GitHub events to Slack channels. These are

Jackson Alves 10 Dec 10, 2022