I don't own a backyard where I live, but I love and treat my own Discord server as if it were my real backyard. That is, I strive to create and maintain an inclusive, friendly, and supportive environment for all the members of my Discord server community. This project, Yard Guard, as a consequence, is created with the goal of being able to moderate and purify the environment of any server on Discord.

What it does and How we built it

As you can see from the video, we built the infrastructure (text/image/audio detection, access revocation, auto-reply, etc. in Discord) using the Discord.js library in javascript with a number of event listeners and callbacks. We used Google Cloud's natural language API to perform sentiment analysis on text messages (how good/bad a message is) and report them to moderators if the sentiment rating goes under a certain threshold.

Google Cloud's Vision API was applied to detect as well as classify text, labels, and/or logos in images sent by a user to the server (deletion and warning follow if there's a need).

Audio file transcription was supported by Google Cloud's Text-to-Speech library so that we can reject any audio source that contains inappropriate content.

Finally, there is more to Yard Guard than just its prohibitive nature. The bot uses Google Cloud's translation service to automatically detect the language of any text message and translate the content into English if the original language isn't. This feature can be really beneficial if your server is based in Europe or in some other areas such as Quebec, Canada.

We used Cloud Firestore to keep miscellaneous data such as the prohibited words and image labels, as well as the number of times a user has been warned, etc. We are very thankful for the very simple and easy-to-use programming interface to a NoSQL database and a powerful web console/dashboard that Firestore provides. The -add and -remove command can be used in Discord to help moderates add or delete prohibited content in speech. We don't hope that they use it to censor a lot of things as some governments do, but we offer server owners the right to determine what should be banned at their own discretion.

Our application is, in essence, powered by Node.js, and so we also have deployed it to GCP's App Engine (please see image attachments) so that it will be there running forever, even when our computers are all shut down :)

Challenges we ran into

Many object structures in the Discord javascript library are extremely hard to interpret and understand, and this cost us a lot of time. Some parts of the Google Cloud APIs (e.g. Vision, Text-to-Speech) were as well.

Accomplishments that I'm proud of

As a half-sized team, we made all functionalities of our project working as intended in a very short time period. We also successfully and smoothly connected the exterior libraries, achieving a highly desirable code structure.

What we learned

In-depth Discord.js, various Google Cloud APIs (was amazed that they were so useful and perfectly fit our needs), and the design of the code structure of a project with various functionalities (coupling vs. cohesion).

What's next for Yard Guard

We will advertise it and in the meantime make the infrastructural utilities steadier. We hope that more people can know about this project and set it up on their own servers!

Built With

  • app-engine
  • cloud-firestore
  • cloud-natural-language-api
  • cloud-speech-to-text-api
  • cloud-translate-api
  • cloud-vision-api
  • discord.js
  • dotenv
  • google-cloud
  • javascript
  • node.js
Share this project: