Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 165 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,107 @@

## Quick Start

### 1. Clone and Build
### Installation Options

You can either download a pre-built binary or build from source.

#### Option 1: Download Pre-built Binary

**Linux (AMD64)**
```bash
# Clone the repository
git clone https://github.com/RusEu/RadminTelegramBot.git
cd RadminTelegramBot
# Download the release (replace v1.0.0 with the latest version)
wget https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-linux-amd64.tar.gz

# Install Go dependencies
go mod download
# Extract
tar -xzf server-admin-bot-linux-amd64.tar.gz

# Build the binary
go build -o server-admin-bot ./cmd/bot/main.go
# Move to system path
sudo mv server-admin-bot-linux-amd64 /usr/local/bin/server-admin-bot

# Make executable
sudo chmod +x /usr/local/bin/server-admin-bot
```

**Linux (ARM64)**
```bash
# Download the release (replace v1.0.0 with the latest version)
wget https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-linux-arm64.tar.gz

# Extract
tar -xzf server-admin-bot-linux-arm64.tar.gz

# Move to system path
sudo mv server-admin-bot /usr/local/bin/
sudo mv server-admin-bot-linux-arm64 /usr/local/bin/server-admin-bot

# Make executable
sudo chmod +x /usr/local/bin/server-admin-bot
```

**Alternative: Download Pre-built Release**
**macOS (Intel)**
```bash
# Download the release (replace v1.0.0 with the latest version)
curl -L https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-darwin-amd64.tar.gz -o server-admin-bot-darwin-amd64.tar.gz

# Extract
tar -xzf server-admin-bot-darwin-amd64.tar.gz

# Move to system path
sudo mv server-admin-bot-darwin-amd64 /usr/local/bin/server-admin-bot

# Make executable
sudo chmod +x /usr/local/bin/server-admin-bot
```

**macOS (Apple Silicon)**
```bash
# Download the latest release (replace with your architecture)
wget https://github.com/RusEu/RadminTelegramBot/releases/latest/download/server-admin-bot-linux-amd64.tar.gz
# Download the release (replace v1.0.0 with the latest version)
curl -L https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-darwin-arm64.tar.gz -o server-admin-bot-darwin-arm64.tar.gz

# Extract
tar -xzf server-admin-bot-linux-amd64.tar.gz
tar -xzf server-admin-bot-darwin-arm64.tar.gz

# Move to system path
sudo mv server-admin-bot /usr/local/bin/
sudo mv server-admin-bot-darwin-arm64 /usr/local/bin/server-admin-bot

# Make executable
sudo chmod +x /usr/local/bin/server-admin-bot
```

### 2. Configure
**Windows (AMD64)**
```powershell
# Download the release (replace v1.0.0 with the latest version) using PowerShell
Invoke-WebRequest -Uri "https://github.com/RusEu/RadminTelegramBot/releases/download/v1.0.0/server-admin-bot-windows-amd64.zip" -OutFile "server-admin-bot-windows-amd64.zip"

# Extract (using PowerShell)
Expand-Archive -Path server-admin-bot-windows-amd64.zip -DestinationPath .

# Run the executable
.\server-admin-bot-windows-amd64.exe -config config.yaml
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration path shown here is a relative path config.yaml, but this assumes the config file is in the same directory as the executable. For consistency with the other Windows examples (lines 260, 275) and to avoid confusion, consider using an absolute path like C:\Path\To\config.yaml and adding a note that users should replace this with their actual config file location.

Copilot uses AI. Check for mistakes.
```

> **Note:** Replace `v1.0.0` with the latest version tag. Check the [releases page](https://github.com/RusEu/RadminTelegramBot/releases) for available versions.

#### Option 2: Build from Source

```bash
# Clone the repository
git clone https://github.com/RusEu/RadminTelegramBot.git
cd RadminTelegramBot

# Install Go dependencies
go mod download

# Build the binary
go build -o server-admin-bot ./cmd/bot/main.go

# Move to system path (Linux/macOS)
sudo mv server-admin-bot /usr/local/bin/

# Make executable (Linux/macOS)
sudo chmod +x /usr/local/bin/server-admin-bot
```

### Configuration

```bash
# Create config directory
Expand Down Expand Up @@ -88,7 +152,9 @@ monitoring:
disk_alert_threshold: 95
```

### 3. Create System Service
#### Linux/macOS System Service

Create a systemd service file (Linux only):

```bash
# Create service file
Expand All @@ -114,7 +180,7 @@ RestartSec=5
WantedBy=multi-user.target
```

### 4. Start the Service
#### Starting the Service (Linux)

```bash
# Reload systemd
Expand All @@ -128,6 +194,88 @@ sudo systemctl start server-admin-bot
sudo systemctl status server-admin-bot
```

#### macOS Launch Agent

For macOS, create a Launch Agent:

```bash
# Create LaunchAgents directory if it doesn't exist
mkdir -p ~/Library/LaunchAgents

# Create launch agent plist file
nano ~/Library/LaunchAgents/com.radmin.telegrambot.plist
```

Add the following configuration:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.radmin.telegrambot</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/server-admin-bot</string>
<string>-config</string>
<string>/etc/server-admin-bot/config.yaml</string>
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config path /etc/server-admin-bot/config.yaml is not appropriate for macOS user-level Launch Agents. On macOS, user Launch Agents don't typically have permission to access /etc directories. Consider using a user-accessible path like ~/Library/Application Support/server-admin-bot/config.yaml or documenting that users should adjust the path to their actual config location.

Suggested change
<string>/etc/server-admin-bot/config.yaml</string>
<string>/Users/USERNAME/Library/Application Support/server-admin-bot/config.yaml</string>

Copilot uses AI. Check for mistakes.
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/server-admin-bot.err</string>
<key>StandardOutPath</key>
<string>/tmp/server-admin-bot.out</string>
</dict>
</plist>
```

Load and start the agent:

```bash
# Load the agent
launchctl load ~/Library/LaunchAgents/com.radmin.telegrambot.plist

# Start the agent
launchctl start com.radmin.telegrambot

# Check status
launchctl list | grep radmin
```

#### Windows Service

For Windows, you can run the bot as a service using NSSM (Non-Sucking Service Manager) or Task Scheduler:

**Using NSSM:**

```powershell
# Download NSSM from https://nssm.cc/download
# Extract nssm.exe to a directory

# Install the service
.\nssm.exe install ServerAdminBot "C:\Path\To\server-admin-bot-windows-amd64.exe" "-config" "C:\Path\To\config.yaml"

Comment on lines +259 to +261
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NSSM command syntax is incorrect. The install command should have the arguments as separate quoted strings or combined in the Application parameters. The current syntax with multiple separate quoted arguments after the executable path may not work as intended. Consider using the format: .\nssm.exe install ServerAdminBot "C:\Path\To\server-admin-bot-windows-amd64.exe" and then setting application parameters separately with .\nssm.exe set ServerAdminBot AppParameters "-config C:\Path\To\config.yaml".

Suggested change
# Install the service
.\nssm.exe install ServerAdminBot "C:\Path\To\server-admin-bot-windows-amd64.exe" "-config" "C:\Path\To\config.yaml"
# Install the service (set executable path)
.\nssm.exe install ServerAdminBot "C:\Path\To\server-admin-bot-windows-amd64.exe"
# Set application parameters (configuration file)
.\nssm.exe set ServerAdminBot AppParameters "-config C:\Path\To\config.yaml"

Copilot uses AI. Check for mistakes.
# Start the service
.\nssm.exe start ServerAdminBot

# Check service status
.\nssm.exe status ServerAdminBot
```

**Using Task Scheduler:**

1. Open Task Scheduler
2. Create a new task
3. Set trigger to "At startup"
4. Set action to start the program: `server-admin-bot-windows-amd64.exe`
5. Add argument: `-config C:\Path\To\config.yaml`
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Task Scheduler instructions use backslashes in the argument path (-config path\to\config.yaml), but this is inconsistent with the absolute paths shown elsewhere (e.g., C:\Path\To\config.yaml). For clarity, use a complete example path like -config C:\Path\To\config.yaml to match the format used in the NSSM example.

Copilot uses AI. Check for mistakes.
6. Configure to run whether user is logged on or not
7. Save and run the task

## Getting Your Bot Token

1. Message [@BotFather](https://t.me/BotFather) on Telegram
Expand Down