Inspiration

Users on Discord are constantly being subjected to malicious links and files from accounts they might trust, which have already been taken over. Hackers abuse trust and use innocent people to steal account info, passwords and other credentials.

Discord Defender was inspired by the lack of progress on Discord’s end to solve this issue, and the fact that general moderation bots don’t have virus scanning capabilities. Using a regex to catch malicious links doesn’t always work, and files can only be checked if they’re downloaded.

What it does

Discord Defender is a Discord bot that checks messages for suspicious files and links, and uploads them to a cloud-based real-time virus-scanning tool that analyzes them and flags possible dangers. If a message is deemed harmful, it is deleted and the contents are copied to a quarantine channel for further investigation, along with some general info about the author of that message. Setup is done via one simple command: -setup, which creates a quarantine channel and stores it as the server’s default channel for suspicious messages. Once setup is complete, servers can relax and let the bot handle the rest.

How we built it

To start, we needed to find a tool that could scan viruses, and which had an API. We used C# & the ASP.NET framework to create a middleware that could interact with the bot and the tool’s API. The bot itself was created using TypeScript (a superset of Javascript, with types) and discord.js, a wrapper for Discord’s bot API. To not spam API calls with every message the bot receives, we implemented a cache feature that checks if the same file was sent and returns an existing response.

Challenges we ran into

  • Virustotal was our first idea for a virus scanning tool, but it took too long to give results.
  • Writing working code that didn't crash every 5 minutes.
  • Editing the video for our pitch.

Accomplishments that we're proud of

  • We're proud of the fact that we found another virus scanning service, and managed to completely rewrite our middleware to use it.
  • Our pitch turned out better than we thought it would.
  • The bot actually has all the features we planned for it, and it was done with some time to spare (!!!).

What we learned

  • How to write a better Discord bot.
  • How to edit videos to make them funnier / better.
  • How to use APIs and virus scanners.

What's next for Discord Defender

  • More commands, more customization would be the next goal.
  • Having per-server settings, with an efficient way to store them.

Built With

Share this project:

Updates