Chatter is a real-time chat application built using Django, Django Channels, and WebSockets. The application supports multiple chat rooms, user authentication, and features a simple AI chatbot that interacts with users, providing assistance and entertainment. The AI chatbot includes a basic keyword-matching system and supports playing games like Hangman. Additionally, the application includes a recap feature that summarizes missed messages, ensuring users stay updated with ongoing conversations.
-
Real-Time Chat
- WebSockets: Leveraging Django Channels for real-time communication, enabling users to chat instantly in various chat rooms.
- Multiple Chat Rooms: Users can create, join, and leave chat rooms. Each room is independent, and users can participate in multiple rooms.
- Message History: Chat history is stored and loaded when a user joins a room, ensuring that conversations persist across sessions.
- User Authentication: Integrated user registration and login system using Django’s built-in authentication framework.
-
AI Chatbot
- AI Powered Chatbot: The application includes an OpenAI-powered chatbot, "ChatterBox," that users can interact with by prefixing messages with a designated command (e.g., !). The chatbot can respond to queries, provide summaries, and engage in simple conversational tasks.
- Hangman Game: Users can play a game of Hangman by entering the !hangman command. The bot manages the game state, taking guesses and providing feedback.
-
Recap Feature
- Automatic Recap Summary: When users rejoin a chat room, they receive a recap of all the messages they missed since their last visit, helping them catch up on important discussions.
-
User Interface
- Bootstrap-Enhanced UI: A clean, responsive interface built with Bootstrap, offering an intuitive user experience.
- Message Bubbles: User messages are displayed in styled chat bubbles, with different colors for users and the chatbot.
- Scroll Management: Automatic scrolling ensures that users always see the latest messages without manual intervention.
-
Admin Features
- Manage Users and Rooms: Administrators can manage chat rooms and users through Django's admin panel.
- Message Moderation: Admins can delete messages or clean up chat histories if necessary.
- User Roles: Different user roles (e.g., Admin, Moderator, Regular User) can be assigned to manage permissions.
- Python 3.8+
- Django 3.0+
- Django Channels
- Redis (for channel layer)
- Clone the repository:
git clone https://github.com/yourusername/Chatter.git cd Chatter
- Create a virtual environment:
python3 -m venv venv source venv/bin/activate
- Install the dependencies:
pip install -r requirements.txt
- Set up the database:
python manage.py migrate
- Run Redis (if not running):
redis-server
- Create a superuser (for admin access):
python manage.py createsuperuser
- Run the development server:
python manage.py runserver
- Access the application:
- Open your browser and navigate to http://127.0.0.1:8000/
- Create Rooms: Users can create new chat rooms from the homepage.
- Join Rooms: Users can join existing chat rooms by entering the room name.
- Chat with Others: Start chatting with others in real-time. The message history is available upon joining the room.
- Interact with Chatbot: Use the prefix '!' to interact with the Ai Chatbot
- Play Hangman: Type !hangman to start a Hangman game with the chatbot. Guess letters using !guess .
- Stay Updated: If you re-enter a chat room, a recap summary will provide you with a summary of all missed messages.