189 lines
6.1 KiB
Markdown
189 lines
6.1 KiB
Markdown
I wrote this bot in one night, while I'm recovering from two level cervical spinal surgery, CDA Cervical Discectomy and Disc Arthroplasty. Expect a lot of bugs.
|
||
|
||
# Matrix Bot
|
||
|
||
Matrix Bot is a Python-based chat bot designed to work with Matrix, an open network for secure, decentralized communication. This bot is built using the `simplematrixbotlib` library and provides various commands and functionalities for interacting with Matrix rooms.
|
||
|
||
## Features
|
||
|
||
- Modular architecture: Commands are implemented as separate plugins, making it easy to add or modify functionality.
|
||
- Command handling: The bot listens for specific commands prefixed with `!` and responds accordingly.
|
||
- Plugin system: Each command is implemented as a separate plugin module, allowing for easy customization and extension.
|
||
- Extensible: Users can add new commands by creating additional plugin modules.
|
||
|
||
## Automatic Installation
|
||
Run the installation script
|
||
1. `./install-funguy.sh`
|
||
|
||
2. Launch the bot:
|
||
`sudo systemctl start funguybot`
|
||
|
||
## Manual Installation
|
||
|
||
1. Create python venv
|
||
`python3 -m venv venv`
|
||
`source venv/bin/activate`
|
||
|
||
2. Clone the repository:
|
||
`git clone https://gitlab.com/Eggzy/funguybot.git`
|
||
|
||
3. Apply the patch
|
||
`cp api.py.patch simplematrixbotlib`
|
||
`git apply api.py.patch`
|
||
|
||
4. Install dependencies:
|
||
`cd simplematrixbotlib && pip install .`
|
||
`cd ../ && pip install -r requirements.txt`
|
||
|
||
5. If you use the Goodreads quote plugin (quote.py):
|
||
|
||
`pip install playwright beautifulsoup4 lxml`
|
||
`playwright install chromium`
|
||
|
||
6. Set up environment variables:
|
||
Create/Edit `.env` file in the root directory of the bot and add the following variables:
|
||
|
||
```
|
||
MATRIX_URL="https://matrix.org" (or another homeserver)
|
||
MATRIX_USER=""
|
||
MATRIX_PASS=""
|
||
OPENWEATHER_API_KEY="" # Optional: For weather plugin
|
||
|
||
SMTP_SERVER = "example.com`"
|
||
SMTP_PORT = 465
|
||
SMTP_USER = "name@domain.tld"
|
||
SMTP_PASSWORD = "somepassword"
|
||
|
||
OPENWEATHER_API_KEY=
|
||
SHODAN_KEY=
|
||
DNSDUMPSTER_KEY=
|
||
LASTFM_API_KEY=
|
||
YOUTUBE_API_KEY=
|
||
|
||
INFERMATIC_API=
|
||
INFERMATIC_MODEL=
|
||
OMDB_API_KEY=
|
||
GNEWS_API_KEY=
|
||
```
|
||
|
||
7. Create systemd.service
|
||
Create `/etc/systemd/system/funguybot.service`
|
||
Replace `$working_directory` with your bot install path
|
||
|
||
```
|
||
[Unit]
|
||
Description=Funguy Bot Service
|
||
After=network.target
|
||
|
||
[Service]
|
||
Type=simple
|
||
User=$user
|
||
Group=$group
|
||
WorkingDirectory=$working_directory
|
||
ExecStart=$working_directory/start-funguy.sh
|
||
Restart=on-failure
|
||
StandardOutput=syslog
|
||
StandardError=syslog
|
||
SyslogIdentifier=funguybot
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
EOF
|
||
```
|
||
|
||
8. Launch Fungy
|
||
```
|
||
systemctl daemon-reload
|
||
systemctl enable funguybot
|
||
systemctl start funguybot
|
||
```
|
||
|
||
# 🍄 Funguy Bot Commands 🍄
|
||
|
||
## Available Plugins
|
||
|
||
The bot includes the following plugins:
|
||
|
||
- **admin.py**: Full room moderation – multi-word name support
|
||
- **arxiv.py**: arXiv academic paper search
|
||
- **bitcoin.py**: Current Bitcoin price
|
||
- **common.py**: Shared utilities for FunguyBot plugins.
|
||
- **config.py**: Admin-only configuration commands (preserves disabled plugins)
|
||
- **cron.py**: In-process cron scheduler (room-aware, no system crontab)
|
||
- **date.py**: Show current date and time
|
||
- **ddg.py**: DuckDuckGo search plugin
|
||
- **dictionary.py**: Look up word definitions using system dictionary
|
||
- **dns.py**: DNS reconnaissance (SSRF-safe)
|
||
- **dnsdumpster.py**: DNSDumpster domain reconnaissance
|
||
- **encode.py**: Comprehensive CyberChef-like encoding and analysis toolkit
|
||
- **exploitdb.py**: Exploit-DB search
|
||
- **fortune.py**: Random fortune message
|
||
- **geo.py**: IP geolocation lookup
|
||
- **hackernews.py**: Hacker News integration
|
||
- **hashid.py**: Hash type identifier
|
||
- **headers.py**: HTTP security header analysis
|
||
- **help.py**: Plugin for dynamically aggregating help from all loaded plugins.
|
||
- **imdb.py**: IMDb lookup via OMDb API
|
||
- **infermatic-text.py**: AI text generation via Infermatic API
|
||
- **isup.py**: Check if a site is up
|
||
- **joke.py**: Get random jokes from the Official Joke API
|
||
- **karma.py**: Room karma tracking system (display names only, no Matrix IDs)
|
||
- **lastfm.py**: Last.fm music stats with aligned code block output
|
||
- **loadplugin.py**: Load/unload plugins at runtime
|
||
- **news.py**: News headlines via GNews API
|
||
- **plugins.py**: List all loaded plugins with count
|
||
- **proxy.py**: Working SOCKS5 proxy finder
|
||
- **quote.py**: Fetch Goodreads quotes
|
||
- **roomstats.py**: Per-user room statistics
|
||
- **shodan.py**: Shodan.io reconnaissance
|
||
- **sslscan.py**: SSL/TLS security scanner
|
||
- **stable-diffusion.py**: Stable Diffusion image generation (LORA support)
|
||
- **subdomains.py**: Subdomain enumeration via CertSpotter
|
||
- **subnet.py**: Subnet calculator
|
||
- **sysinfo.py**: System information plugin
|
||
- **timezone.py**: World clock (offline IANA zones + free geocoding)
|
||
- **urbandictionary.py**: Urban Dictionary definitions
|
||
- **utils.py**: Security utilities for Funguy Bot plugins.
|
||
- **weather.py**: Weather data plugin
|
||
- **welcome.py**: Room welcome message
|
||
- **whois.py**: Domain WHOIS lookup
|
||
- **wikipedia.py**: Wikipedia article summary
|
||
- **xkcd.py**: Fetch random or specific xkcd comics
|
||
- **youtube-search.py**: YouTube video search
|
||
|
||
## Configuration
|
||
|
||
The bot uses a TOML configuration file (`funguy.conf`) for settings:
|
||
- `admin_user` - Matrix user ID with admin privileges
|
||
- `prefix` - Command prefix (default: "!")
|
||
- Plugin-specific settings in `plugins/ai.json` for AI commands
|
||
|
||
## Dependencies
|
||
|
||
- Python 3.7+
|
||
- simplematrixbotlib
|
||
- Various AI/ML services (Stable Diffusion, Ollama, etc.)
|
||
- Database support (SQLite)
|
||
- External APIs (OpenWeatherMap, Urban Dictionary, YouTube)
|
||
|
||
## Dependencies
|
||
|
||
- Ensure all environment variables are set correctly
|
||
- Check that required services are running (Stable Diffusion API, Ollama, etc.)
|
||
- Verify plugin permissions and whitelist settings
|
||
- Check logs for detailed error information
|
||
|
||
## Support
|
||
|
||
Join our Matrix room for support and community:
|
||
[Self-hosting | Security | Sysadmin | Homelab | Programming](https://matrix.to/#/#selfhosting:mozilla.org)
|
||
|
||
## Credits
|
||
|
||
**🧙♂️ Creator & Developer**: HB (@hashborgir:mozilla.org)
|
||
**🍄 Funguy Bot** - Created during recovery from cervical spinal surgery
|
||
|
||
---
|
||
|
||
*Note: This bot was created rapidly and may contain bugs. Please report issues and contribute improvements!*
|