NyaChat is a simple terminal-based chat application built with Python. It allows multiple users to connect to a server, exchange messages in real-time, and optionally use a server password for security. The client features sound notifications for incoming messages and supports nickname customization
- Connect multiple clients to a single server
- Optional server password protection
- Customizable nickname for each client
- Real-time message broadcasting
- Display list of online users (
/listcommand) - Exit cleanly with
/exit - Sound notifications for new messages
- Easy configuration using a
config.jsonfile
- Python 3.8+
prompt_toolkitlibrary (for enhanced input handling)- Windows only (for
winsoundnotifications)
Install dependencies using pip:
pip install prompt_toolkitserver.py– The server script. Handles multiple clients, broadcasting messages, and optional password protectionnyachat.py– The client script. Connects to the server, sends/receives messages, and plays notification soundsconfig.json– Client configuration file (created automatically if missing)sounds/received.wav– Notification sound for incoming messages
- Run the server script:
python server.py- Follow the menu:
=== Server Menu ===
1 - Start server
2 - Set password
0 - Exit
- Clients can now connect to the server using its IP and port
1234
- Run the client script:
python nyachat.py- Main menu:
=== NyaChat ===
1 - Connect
2 - Settings
0 - Exit
- Before connecting, set your IP, nickname, and optional password in the Settings menu
- Use
/exitto disconnect from the server - Use
/listto see all online users - Use
/helpto see available commands
The client stores settings in config.json. Example:
{
"ip": "192.168.1.10",
"nickname": "Alice",
"password": "mypassword"
}ip– Server IP addressnickname– Your chat nicknamepassword– Server password (if required)