60 lines
1.9 KiB
Markdown
60 lines
1.9 KiB
Markdown
# Autoscale Bot
|
||
|
||
A self‑hosted Discord bot for managing a Headscale instance.
|
||
|
||
## Features
|
||
- Create, delete and manage Headscale users
|
||
- Link Discord accounts to Headscale users
|
||
- Register and rename nodes
|
||
- Ticketing system for support
|
||
- **Auto‑Updater**: Checks the GitHub repository for new releases, notifies the bot owner, and offers an in‑Discord update prompt.
|
||
|
||
## Installation
|
||
```bash
|
||
# Clone the repository
|
||
git clone https://github.com/jadonkortislolz-wq/autoscale.git
|
||
cd autoscale
|
||
npm install
|
||
```
|
||
|
||
Create a `.env` file (do **not** commit it) with the required variables:
|
||
```
|
||
BOT_TOKEN=your_discord_bot_token
|
||
HEADSCALE_URL=https://your-headscale-url
|
||
HEADSCALE_CONTAINER=headscale
|
||
BOT_OWNER_ID=your_discord_user_id
|
||
# optional tickets config
|
||
TICKET_CATEGORY_ID=your_category_id
|
||
TICKET_SUPPORT_ROLE_ID=your_support_role_id
|
||
```
|
||
|
||
Start the bot (PM2 recommended):
|
||
```bash
|
||
npm start # or pm2 start ecosystem.config.js
|
||
```
|
||
|
||
## Usage
|
||
All commands are prefixed with `!hs` or `!headscale`.
|
||
- `!hs create <username>` – Create a Headscale user
|
||
- `!hs discord <username>` – Link your Discord account to a Headscale user
|
||
- `!hs link <nodekey>` – Register a device
|
||
- `!hs register` – Get the Tailscale registration command
|
||
- `!hs list` – List all nodes and IPs
|
||
- `!hs rename <id> <new_name>` – Rename your node
|
||
- `!hs info` – Bot information
|
||
- Ticket commands: `!hs ticket panel`, `!hs ticket close`
|
||
- Admin commands: `!hs restart`, `!hs addadmin @user`, etc.
|
||
- `!hs update` – Check for a new version and update the bot
|
||
|
||
## Auto‑Updater
|
||
The bot automatically checks the GitHub repository for new releases every hour.
|
||
1. If a newer version is found, the bot owner receives a DM:
|
||
> "A new version **vX.Y.Z** is available. Run `!hs update` to apply it."
|
||
2. Running `!hs update` pulls the latest code, installs dependencies, and restarts the bot.
|
||
|
||
## Contributing
|
||
Feel free to open issues or submit pull requests. Ensure you do not commit any secrets.
|
||
|
||
## License
|
||
ISC
|