FunguyBot/README.md

138 lines
4.7 KiB
Markdown
Raw Normal View History

2024-02-12 22:24:05 +00:00
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.
2024-02-12 22:07:54 +00:00
# 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
2024-02-14 00:01:58 +00:00
Run the installation script
1. `./install-funguy.sh`
2024-02-14 00:01:58 +00:00
2. Launch the bot:
`sudo systemctl start funguybot`
## Manual Installation
2024-02-12 22:07:54 +00:00
2024-02-14 00:01:58 +00:00
1. Create python venv
`python3 -m venv venv`
`source venv/bin/activate`
2. Clone the repository:
2024-02-12 22:51:15 +00:00
`git clone https://git.stoned.io/hash/FunguyBot`
2024-02-12 22:07:54 +00:00
2024-02-14 00:01:58 +00:00
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`
2024-02-12 22:07:54 +00:00
3. Set up environment variables:
2024-02-14 00:01:58 +00:00
Create/Edit `.env` file in the root directory of the bot and add the following variables:
2024-02-12 22:07:54 +00:00
```
MATRIX_URL="https://matrix.org" (or another homeserver)
MATRIX_USER=""
MATRIX_PASS=""
```
2024-02-14 00:01:58 +00:00
4. 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
```
2024-02-12 22:07:54 +00:00
2024-02-14 00:01:58 +00:00
5. Launch Fungy
```
systemctl daemon-reload
systemctl enable funguybot
systemctl start funguybot
```
2024-02-12 22:07:54 +00:00
## Usage
To use the bot, invite it to a Matrix room and interact with it by sending commands prefixed with `!`. For example:
- `!date`: Display the current date and time.
- `!fortune`: Get a random fortune message.
- `!proxy`: Retrieve and test random SOCKS5 and HTTP proxies.
- `!isup <domain/ip>`: Check if the specified domain or IP address is reachable.
- `!karma <user>`: View or modify karma points for a user.
2024-02-14 00:01:58 +00:00
- `!funguy <prompt>` Talk to the Tech AI LLM
- `!music <prompt>` Talk to the music knowledge LLM
2024-02-12 22:07:54 +00:00
For a complete list of available commands and their descriptions, use the `!commands` command.
# 🍄 Funguy Bot Commands 🍄
🃏 **!fortune**
Returns a random fortune message.
Executes the `/usr/games/fortune` utility and sends the output as a message to the chat room.
**!date**
Displays the current date and time.
Fetches the current date and time using Python's `datetime` module and sends it in a formatted message to the chat room.
💻 **!proxy**
Retrieves a tested/working random SOCKS5 proxy.
Fetches a list of SOCKS5 proxies, tests their availability, and sends the first working proxy to the chat room.
📶 **!isup <domain/ip>**
Checks if the specified domain or IP address is reachable.
Checks if the specified domain or IP address is reachable by attempting to ping it. If DNS resolution is successful, it checks HTTP and HTTPS service availability by sending requests to the domain.
**!karma <user>**
Retrieves the karma points for the specified user.
Retrieves the karma points for the specified user from a database and sends them as a message to the chat room.
2024-02-12 22:31:11 +00:00
**!karma user up**
2024-02-12 22:07:54 +00:00
Increases the karma points for the specified user by 1.
Increases the karma points for the specified user by 1 in the database and sends the updated points as a message to the chat room.
2024-02-12 22:31:11 +00:00
**!karma user down**
2024-02-12 22:07:54 +00:00
Decreases the karma points for the specified user by 1.
Decreases the karma points for the specified user by 1 in the database and sends the updated points as a message to the chat room.
2024-02-13 04:12:03 +00:00
📄 **!funguy [prompt]**
2024-02-13 04:00:59 +00:00
An AI large language model designed to serve as a chatbot within a vibrant and diverse community chat room hosted on the Matrix platform.
(Currently loaded model: **TheBloke_Mistral-7B-Instruct-v0.2-GPTQ**
2024-02-13 04:23:24 +00:00
🎝 **!music [prompt]**
Your music expert! Try it out.
2024-02-12 22:07:54 +00:00
# 🌟 Funguy Bot Credits 🌟
2024-02-13 00:46:18 +00:00
🧙‍♂️ Creator & Developer:
- Hash Borgir is the author of 🍄Funguy Bot🍄. (@hashborgir:mozilla.org)
# Join our Matrix Room:
[Self-hosting | Security | Sysadmin | Homelab | Programming](https://chat.mozilla.org/#/room/#selfhosting:mozilla.org)