The internet is a great place to be creative, have fun, meet people, and much more. But as our lives become more and more online, the spread of misinformation has increased on many social media platforms. Now more than ever, more people are believing conspiracy theories, creating fake content, and spreading lies for likes on different platforms. This misinformation problem is incredibly significant, as conspiracy theories and lies are the root cause of events such as the January 6th attack on the United States capital, which caused a ton of damage, people feeling unsafe, and in the end death.

What it does

Discord is a great place to build communities, meet friends, play games, and run hackathons :p. Though, as it is an internet application, conspiracy theories, lies, and more could still be spread. I created a Discord bot that can detect this misinformation using the Google Fact Check Tools API and a filter to automatically detect and check messages containing misinformation, and show everyone else chatting and the message sender that it is misinformation. It displays an embed showing the incorrect fact, the correct fact, and proof to why the correct fact is true. Also, the users who send misinformation are noted down and can be seen by the moderators of the server to act upon their actions. The user detection data, as well as the amount of detections, is collected and can be viewed with the fc!stats command, and the top users can be viewed with the fc!topusers command. If users just want to check if something is true or false, they can run the fc!check command.

For moderators, using commands to get this information can be complicated and spammy, so I created a dashboard for moderators to view detection info and top users as well. The link can be accessed with the fc!dash command.

How I built it

I coded the bot completely in the Discord.js library. This allowed me to detect whenever messages are sent, check if they are fact-like, remove any useless filler words, and then send it to google to do the detection. If google sends that it is a false fact back, the bot replies with a message, showing that the fact is false, and puts the user's detections into the database. For the online dashboard, I used ejs and express to connect with the bot and exchange info to get information on the server, and coded an html and css dashboard to display it.

Challenges I ran into

At the beginning, I was having trouble finding an API that checked for misinformation. Once I found the Google API, I was excited, but it was really badly documented and took me around 45 minutes to get my tests working. After that, everything was smooth sailing until I realized something. If someone said a true fact, like "the earth is not flat", it would still trigger the bot and say that the "earth is not flat" message is false. The google API didn't provide a way of telling how sure it was that it was misinformation, and it was more of a search than a detection. So, I decided to rephrase the bot's response a bit to say the incorrect fact is incorrect, and not that the user's fact is incorrect. My final challenge was getting the bot to connect to the dashboard. I had started this out as a sharded client, which means it is easy to scale. The problem with this is that the bot runs on a separate process, and I needed to figure out how to get the backend and the bot to communicate. I was able to do this with broadcasteval, and some new code I learned!

Accomplishments that I'm proud of

I am really proud of how the project turned out. Originally, I just wanted to make a bot that could check for false information. Throughout the hackathon, I just tried out a lot of stuff and added random features, and learned a lot about web development, backend, frontend and more! I'm most proud of the dashboard, because I've always had trouble with css and making things look good, and I always used to use templates. Now, I really like the design of the bot's dashboard, and how I incorporated both the bot and website into the project.

What I learned

Throughout the project, I had a TON of StackOverflow tabs open. I've definitely learned a lot about CSS, Google APIs, MongoDB, time management, and weather some facts I tested are true or false :p.

What's next for FactCheqr

Next, I plan to make my first completely open source Discord bot, and release the bot to the public. I'm not sure if it can scale well, but if it can, I'd try to get some bigger Discord servers to use the bot to help them with the spread of misinformation. Also, I think that it would be really cool to try to make this for other platforms where misinformation is more prevalent, like Twitter, Facebook, Instagram, TikTok, and more.

Built With

Share this project: