A modern chat bot with CLI and web interfaces for IRC and Slack platforms.
- CLI Interface: Interactive command-line chat with rich terminal output
- Web Interface: Starlette-based web server for HTTP interactions
- Multi-Platform Support: Works with IRC and Slack
- Modern Architecture: Built with Starlette web framework and async Python
- Python 3.7 or later
- Dependencies listed in
requirements.txt
- Set up a Python Virtual Environment:
python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\\Scripts\\activate pip install -r requirements.txt
To enable Slack integration:
-
Create a Slack App:
- Go to https://api.slack.com/apps and click "Create New App"
- Choose "From scratch" and give your app a name
- Select the workspace where you want to install the bot
-
Configure OAuth Scopes:
- Go to "OAuth & Permissions" in your app settings
- Add the following Bot Token Scopes:
app_mentions:read- Listen for @mentionschat:write- Send messageschannels:history- Read channel messagesgroups:history- Read private channel messagesim:history- Read direct messagesmpim:history- Read group direct messages
-
Enable Socket Mode (optional):
- Go to "Socket Mode" in your app settings
- Enable Socket Mode and create an App Token
- Copy the App Token (starts with
xapp-)
-
Install the App:
- Go to "Install App" and install to your workspace
- Copy the Bot User OAuth Token (starts with
xoxb-)
-
Configure Environment Variables:
# Add to your .env file SLACK_BOT_TOKEN=xoxb-your-bot-token-here SLACK_APP_TOKEN=xapp-your-app-token-here # Optional: for Socket Mode
-
Enable Events:
- Go to "Event Subscriptions" in your app settings
- Enable Events and subscribe to:
app_mention- When users @mention your botmessage.im- Direct messages to your bot
-
Start the web server (this starts both IRC and Slack clients):
python j4ne.py web
-
Invite the bot to channels:
- In Slack, type
/invite @your-bot-namein any channel - Or add the bot through the channel settings
- In Slack, type
-
Chat with the bot:
- In channels: @mention the bot:
@j4ne-bot Hello! - Direct messages: Just send a message directly
- The bot will respond in threads for better conversation context
- In channels: @mention the bot:
J4NE provides two main interfaces:
The CLI provides interactive chat and quick commands:
-
Interactive Chat (default):
python j4ne.py chat
or simply:
python j4ne.py
-
Quick Greeting:
python j4ne.py greet "Your Name"
Start the web server for platform integrations:
python j4ne.py webThe web server runs on http://localhost:8000 and provides endpoints for Slack integration.
j4ne.py: Main entry point with CLI and web serverchatters/: Chat functionality and CLI interfacecommands/: Command handlers and processingclients/: Client implementations for different platformsnetworks/: Platform-specific integrations (IRC, Slack)tools/: Tool integrationstests/: Unit tests
The application uses:
- Starlette: Modern async web framework
- Uvicorn: ASGI server for web interface
- Rich: Beautiful terminal output
python j4ne.py --help # Show all available commands
python j4ne.py --verbose # Enable verbose logging
python j4ne.py chat # Start interactive chat (default)
python j4ne.py greet <name> # Send greeting
python j4ne.py web # Start web server- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details