DaisyBot

My submission for the hackathon KnightHacks 2020, of which I am the sole contributor. DaisyBot is a Discord bot that allows the user to track their mood, write a journal entry, and set a bio. The bot utilizes the Discord API, discord.py, and MongoDB with PyMongo and the Google Cloud hosting platform. This bot was made at a beginner (no prior experience) level of MongoDB and PyMongo, and a semi-beginner (some prior experience) level of Python, discord.py, and the Discord API.

Author

Joshua Schladt

Getting Started

You can download the source code for the repository as a ZIP file, or use Git by typing the following command into a terminal:

git clone https://github.com/jmusic54/DaisyBot

You will need to have Python installed along with the following modules installed for the code, which you can do by running the following commands in your command line:

pip install discord.py

pip install pymongo

pip install dnspython

What is DaisyBot?

DaisyBot is a mental health focused bot that allows for discord users to track their mood, write a bio, and store a journal entry. The nifty commands that DaisyBot allows the user to do involve:

  • !botinfo
    • Lets the user see info about DaisyBot in an embedded format.
  • !commandlist
    • Lets the user see all of the available commands that DaisyBot offers, along with an explanation of said commands in an embedded format.
  • !trackmood
    • Allows the user to track their mood and and store it to the database.
  • !trackjournal
    • Allows the user to write a journal entry and stores it to the database.
  • !setbio
    • Allows the user to write a bio and stores it to the database
  • !getmood/journal/bio
    • Three different commands that retrieve the mood, journal entry, and bio for the user from the database, depending on which one was inputted.

Inspirations

I would consider myself to be someone who is a big advocate for mental health. In stressful times especially, trying to take some time to do positive mental health tasks can yield huge benefits for someone. I would also consider myself to be someone who quite enjoys using the Discord platform, along with programming. As such, making a bot that would help a user track their mental health with a mood tracker via Discord felt like a natural choice.

Challenges Faced

For one, this is my first Hackathon submission, so to make a project in such a short period of time and adjusting to the nature of hackathons in itself was a barrier to overcome. In terms of the project itself, while I have worked with Python and discord.py before (albeit not too extensively), this was my first time working with a database in general, along with implementing it into discord.py, so it was quite a lengthy and arduous process for me to overcome. This resulted in some downfalls with my project, since I did not realize until too late in the project development that there was no way for one user to be able to input additional data, however just by the nature of getting the database set up when I have never worked with one before, is in itself a major challenge that I would say I overcame, along with the fact that I was still able to get the bot to still function as it was expected to for the project in terms of it still being able to store and retrieve data from the database. The upcoming "What I Learned" section goes into greater detail how I overcame these said challenges.

What I Learned

As previously stated, since I have never heavily worked with a database before, I learned how to get one set up and connected to my project as a whole. Once set up, I learned how to have a basic usage of PyMongo in order to implement the MongoDB database into my project. Since this project worked with discord.py, I also expanded upon my knowledge of discord.py by learning about and utilizing cogs in my project, which are classes that let you organize a set of commands that can work together. I especially appreciated learning cogs due to the object-oriented nature they hold, which let me further connect that knowledge to topics I am learning in my Object-Oriented Programming class that I am taking this semester. I also learned how to have discord.py and PyMongo work in conjunction with each other so that the discord.py functions can help store to and retrieve from my database.

Built With

Share this project:

Updates