Giter VIP home page Giter VIP logo

capstone_labs's Introduction

Better Basic Chat Bot

Better Basic Chat Bot is a cool bot that utlises java server input output so you can send and recieve messages back from the server!

Installation

Download the latest version of java and your favorite compiler. Then download the code files and run them in the compiler

Functionality and Usage

When first loggin in, a SUBMITNAME request will be sent, so you must enter a username, no whitespaces, with all alphanumeric characters, such as:

WonjunLee 

After that, the client will display and send NAME [name] to the server for processing.

[name] has joined ---> NAME [name]

The user will be greeted by a message from a server which displays [name] has joined.

WELCOME [name] ---> [name] has joined.

It will also display the list of users that are in the server.

LIST [list of names] ---> LIST: name1, name2, ... (only displays when you join or when you type /whoishere)

There are four other messages that the server will display the following to the client

CHAT [name] [msg] ---> [name]: [msg]
PCHAT [name] [msg] ---> [name] (private): [msg]
MUTE [name] ---> You have been muted by [name]
MUTED ---> You are muted. Type /unmute to unmute yourself.
UNMUTE ---> You are unmuted. You can talk now!
EXIT [name] ---> [name] has left.

Chat sends a public messages that displays the name and message. A private chat displays only to the mentioned username the message, along with a private tag to denote that it is private. The private message can be sent to multiple people by using multiple "@username" command in one line. The mute will allow the client to mute other users or yourself. After muting someone, it will display to that user that you have muted that user and that user will not be able to talk until he unmutes himself. While the user is muted, no one will be able to see his text, and only he will be able to see that he is muted and has to type /unmute to unmute himself. /whoishere displays all the users currently connected to the server. The exit message exits the server while displaying who has left.

To make it easier for the client to not have to type out annoying headers, we have shorthands that send the following messages to the server

*(during naming) ---> NAME [name]
*(other times) ---> CHAT [msg]
/mute username ---> MUTE [username]
/unmute ---> UNMUTE
@username * ---> PCHAT [username] [msg]
@username1 @username2 @username3... * ---> PCHAT [username1] [msg], PCHAT [username2] [msg], ...
/quit  ---> QUIT
/whoishere ---> LIST

These Message headers (e.g. NAME, CHAT, MUTE, etc.) are now their own objects, not String. The communication between the server and client is also serialized, sending object instead of String.

GUI Implementation

Our program now has a GUI using javafx. After running the program, you will be able to connect to the server and then will be given a text box to enter your name. The rules are same for your name: no whitespaces with all alphanumeric characters. In GUI, the list of the users present in the server will be displayed on the right side. The mute function is now moved to the bottom right with a button system. If you click on the button, you will be provided with a new window, where you will be able to type the username of who you would like to mute. There is also unmute button that will only activate when you are muted. Functions, such as /whoishere and /quit, are removed as they are now implemented in other ways in GUI system, but PCHAT with multiple recipients using @ would still work. Both the GUI and original Chat system shares same Message header, allowing for more flexibility.

Process

We first had to seperate the inner classes into their own classes to prevent merge conflicts. Then we started to see how the code worked, and then implement the requested features, coming up with our own mute feautre.

capstone_labs's People

Contributors

jasonw0416 avatar daduuu avatar

Watchers

James Cloos avatar

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.