A scalable, extensible bot system built in Go (Golang) for handling direct messages (DMs), group chats, and automated event handling on the Nostr network.
- β
Direct Message Bot (
support_bot
) β Handles user queries and support via encrypted direct messages. - β
Group Chat Bot (
weather_bot
) β Broadcasts weather updates to group channels. - β
Welcome Bot (
welcome_bot
) β Greets new users in group channels. - β
Session Manager Bot (
session
) β Manages multi-bot sessions (Yin and Yang) for interaction. - β Extensible Plugin System β Supports global and handler-specific plugins (e.g., logging, notifications).
- β Dockerized Deployment β Easily deploy with Docker, including auto-restart capabilities.
- β Auto-Resilience β Automatically restarts if the bot crashes or encounters errors.
- β Dynamic Configuration β Load bot configurations via YAML files.
Create a .env
file in the root directory with the following values:
METEOMATICS_USERNAME=
METEOMATICS_PASSWORD=
Create YAML configuration files inside the configs/
directory.
bots:
- name: "Support Bot"
relay_url: "wss://relay.example.com"
nsec: "your-secret-key"
channel_id: "your-channel-id"
listener: "DMListener"
publisher: "DMPublisher"
handler: "SupportHandler"
event_type: "DMResponseEvent"
bots:
- name: "Weather Bot"
relay_url: "wss://relay.example.com"
nsec: "your-secret-key"
channel_id: "your-channel-id"
listener: "GroupListener"
publisher: "GroupPublisher"
handler: "GroupHandler"
event_type: "GroupResponseEvent"
bots:
- name: "Welcome Bot"
relay_url: "wss://relay.example.com"
nsec: "your-secret-key"
channel_id: "your-channel-id"
listener: "DMListener"
publisher: "GroupPublisher"
handler: "WelcomeHandler"
event_type: "GroupResponseEvent"
bots:
- name: "Yin Bot"
relay_url: "wss://relay.example.com"
nsec: "your-secret-key"
channel_id: "your-channel-id"
listener: "GroupListener"
publisher: "GroupPublisher"
handler: "ExchangeHandler"
event_type: "GroupResponseEvent"
- name: "Yang Bot"
relay_url: "wss://relay.example.com"
nsec: "your-secret-key"
channel_id: "your-channel-id"
listener: "GroupListener"
publisher: "GroupPublisher"
handler: "ExchangeHandler"
event_type: "GroupResponseEvent"
Install dependencies:
go mod download
Run the bot:
go run main.go --config=configs/support_bot.yaml
Step 1: Build the Docker image:
docker-compose build
Step 2: Start the bot using Docker Compose:
docker-compose up -d
Step 3: View logs:
docker logs -f support-bot
Step 4: Stop the bot:
docker-compose down
Command | Description |
---|---|
agent --config=configs/support_bot.yaml |
Starts support bot |
agent --config=configs/weather_bot.yaml |
Starts weather bot |
agent --config=configs/welcome_bot.yaml |
Starts welcome bot |
agent --config=configs/session.yaml |
Starts session with Yin and Yang bots |
Generate project tree:
tree --prune -I "$(paste -sd'|' .treeignore)" > tree.txt
version: "3.8"
services:
support_bot:
build:
context: .
dockerfile: Dockerfile
container_name: support-bot
restart: unless-stopped
env_file:
- .env
command: ["--config=configs/support_bot.yaml"]
volumes:
- ./logs/support:/app/logs
weather_bot:
build:
context: .
dockerfile: Dockerfile
container_name: weather-bot
restart: unless-stopped
env_file:
- .env
command: ["--config=configs/weather_bot.yaml"]
volumes:
- ./logs/weather:/app/logs
welcome_bot:
build:
context: .
dockerfile: Dockerfile
container_name: welcome-bot
restart: unless-stopped
env_file:
- .env
command: ["--config=configs/welcome_bot.yaml"]
volumes:
- ./logs/welcome:/app/logs
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/your-feature
). - Create a new Pull Request.
This project is licensed under the MIT License.
For support or collaboration inquiries, reach out to:
- GitHub Issues
- Email: [email protected]
- Built using Go
- Uses the Nostr protocol
- Dockerized for easy deployment π