Code Monkey home page Code Monkey logo

project-chatbot's Introduction

Wine Chat Bot ๐Ÿท

In this project we built a chat bot who asks questions about wine. We built it by using pair programming. This is our first deep dive into the JavaScript world!

The problem

The main task was to build a chat bot using primarily JavaScript.

We wanted the theme of the chat bot to be about wine where it would be obvious that the chat bot prefers red wine over white. The conversation is between a wine maiden (bot) and a posh wine drinking man (user). So we wanted the bot to initially give the user the option to choose both, but as the conversation continues the user would be directed into the red wine option. If the user in the end don't choose the red wine option, the bot would end the conversation. As the red wine conversation continues, the user will be given options regarding wine country and grapes which the bot responds to accordingly.

We started coding the "skeleton" for the conversation using JavaScript. We added an if statement early on in the code to get the conversation started and the user to choose the direction of it. As the conversation progresses, we continously added messages depending on the user's choice of direction. These messages could be either from the bot or the user. We built the messages in code as a function which typically contains actions where the bot guides the user forward by asking a question and give options to choose from. We used the form HTML tag "button" to display these options for the user and added a event listener to listen for the user's selection ("click"). The buttons where added to an HTML element by using the innerHTML property. Depending on the user's choice, the user was directed to the next question. At the end of the conversation, if the user had chosen the red wine direction, a sound effect was added to the chat. When the JavaScript functionality was in place, we proceeded to style the webpage a bit with CSS.

We're very proud of the end result! We had a concept in mind - a sunny mediterranean beautiful vineyard - which we think we managed to execute very well! If we had more time, we would have added more directions (i.e. more options to choose from) and questions to make the conversation longer and more versatile.

View it live

To view the site we've created, check it here: https://modest-brown-fa7f80.netlify.app/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.