With the holiday season coming up, we've all been thinking a lot about what to get our friends and family. However, the daunting task of dealing with the millions of tabs, saved links, and countless wishlists that come along with holiday shopping left us thinking that there has to be a better way. Thus, we came up with the idea of WishBot, a friendly (but not so friendly sometimes!) bot that helps you streamline your gift-giving process all on Discord!
What it does
WishBot does many things.
For example, imagine you are exploring gift options for your friend Sarah, and you think she might like a blanket. Simply tell WishBot to "give sarah a blanket" and WishBot will add a blanket to Sarah's wishlist. To view this wishlist later, you just need to tell WishBot "retrieve sarah" and WishBot will display Sarah's wishlist. Also, if you want WishBot to find you a specific blanket to give to Sarah, just tell Wishbot to "retrieve sarah's blanket links," and WishBot will present to you a specific blanket listing from Etsy.
However, gift ideas don't always pan out. But don't worry, WishBot has you covered. If you decide later that Sarah wouldn't want a blanket, you can just tell WishBot to "remove sarah's blanket" and you're all good.
Now, you may be thinking, that's all great if I already know if I want to give Sarah a gift and what I want to give her. But what if I don't?
WishBot can still help you!
If you're not sure whether to get Sarah a gift, just ask WishBot for "advice about sarah." WishBot will either tell you to get her a present or not, and you can make your decisions based on that! Now, if you decide to get Sarah a present but you're not sure what, just ask WishBot to "suggest for sarah under ." WishBot will pick an item in your price range and add it to Sarah's wishlist!
How I built it
Oh boy, was this a challenge (we’ll save that for the next section, though)! WishBot is built off of the Discord dependency, implementing Client object functionality rather than a pure bot-side instance. This gives WishBot a more natural feel, helping alleviate the formality of discord ‘!q’ commands. WishBot also relies on syntactic parsing and BeautifulSoup for web scraping by taking a parsed Etsy search string, loading HTML attributes for that webpage, and scanning the page for href attributes, which are then organized by relevance to the search. The projects main files are: bot.py, scraper.py, .env (added to .gitignore to retain bot token privacy)
Challenges I ran into
However, creating WishBot was still a difficult task. We needed to learn how to implement a web scraper and create a bot that responded to user messages, something we had never done before. With the help of various online tutorials and hours of thinking deeply about problems, we were able to create a finished product that performed the tasks we intended.
Accomplishments that I'm proud of
We’re proud of our ability to implement the web scraper that extracts individual project URLs from the Etsy search page, because this took intensive research in order to get working.
What I learned
We learned a lot from this project, both technically and in general. A really important skill we learned from this project is how to see a project through its entirety, from inception to completion. We had never done this before, because all the projects we have done before are the ones part of the CS 61A curriculum, and thus we were always given direction and hints. This time, we had to come up with ideas, discuss their issues, delegate tasks, look up tutorials and examples and try to intertwine them to achieve the desired results, perform tests, and make the code legible to a third party. This was definitely a challenge, but we learned a lot of valuable skills that will help us going forward. We also learned about working with APIs and about the concept of web-scraping, which ended up being two fundamental bases of WishBot.
What's next for WishBot
In the future, we hope to extend WishBot’s functionality. We want to deploy it onto Heroku so that we don’t have to restart it every time it’s used, filter suggestions based on various metrics such as price and ratings, and implement a function that asks whether a user would like to add a suggestion to a wishlist by displaying the product name and soliciting a ‘yes’ or ‘no’ instead of directly adding it.