257 lines
6.4 KiB
Markdown
257 lines
6.4 KiB
Markdown
<div align="center">
|
|
<h1>🤖 OpenClaw x Z.AI Integration Guide</h1>
|
|
<p><strong>A professional setup guide for OpenClaw with Z.AI (GLM 4.7) | Powered by <a href="https://discord.com/channels/1346756824233148527/1442045587467072268/1467513064713621678">Z.AI Community</a></strong></p>
|
|
|
|
[](https://discord.com/)
|
|
[](https://z.ai/)
|
|
[](https://python.org)
|
|
[](LICENSE)
|
|
</div>
|
|
|
|
---
|
|
|
|
## 📄 Table of Contents
|
|
|
|
- [Overview](#overview)
|
|
- [Quick Start](#quick-start)
|
|
- [Prerequisites](#prerequisites)
|
|
- [Installation & Setup](#installation--setup)
|
|
- [Configuration](#configuration)
|
|
- [Testing](#testing)
|
|
- [Next Steps](#next-steps)
|
|
- [Troubleshooting](#troubleshooting)
|
|
- [Contributing](#contributing)
|
|
- [License](#license)
|
|
|
|
---
|
|
|
|
## 🌟 Overview
|
|
|
|
This guide provides a **structured walkthrough** for setting up **OpenClaw** with **Z.AI (GLM 4.7)**.
|
|
|
|
> ⚠️ **Security Notice**: This installation method requires executing a remote script directly from a URL. This is a known security risk (`curl to bash/cmd`). Only proceed if you **explicitly trust the source**.
|
|
|
|
### 🎉 Features
|
|
|
|
- 🤗 AI-powered Discord bot integration
|
|
- 📾 Real-time model configuration
|
|
- 🔐 Customizable authentication
|
|
- 🕺 Advanced network settings
|
|
- 🚫 Message content filtering
|
|
|
|
---
|
|
|
|
## ⚡ Quick Start
|
|
|
|
<details>
|
|
<summary><b>Click to expand quick start guide</b></summary>
|
|
|
|
```bash
|
|
# 1. Open Command Line
|
|
# Windows: Win + R, type 'cmd', hit Enter
|
|
|
|
# 2. Copy and paste the installation command:
|
|
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
|
|
|
|
# 3. Follow the prompts in the console
|
|
|
|
# 4. Test the bot in Discord:
|
|
@OpenClaw who r u
|
|
```
|
|
|
|
</details>
|
|
|
|
---
|
|
|
|
## 📝 Prerequisites
|
|
|
|
Before you begin, ensure you have:
|
|
|
|
- [ ] **Discord Server** - Where you can manage roles and permissions
|
|
- [ ] **Discord Application** - Created in [Discord Developer Portal](https://discord.com/developers/applications)
|
|
- [ ] **Bot Token** - Generated from your Discord application
|
|
- [ ] **Administrator Access** - On your target server
|
|
- [ ] **Z.AI API Key** - Available from [Z.AI Console](https://z.ai/subscribe?ic=R0K78JKIW)
|
|
- [ ] **Windows/Linux/Mac** - With command line access
|
|
|
|
---
|
|
|
|
## 🛠️ Installation & Setup
|
|
|
|
### Phase 1: Core Installation
|
|
|
|
#### Step 1: Open Command Line
|
|
|
|
**On Windows:**
|
|
```bash
|
|
Win + R # Open Run dialog
|
|
type: cmd # Type command
|
|
Press: Enter # Execute
|
|
```
|
|
|
|
**On macOS/Linux:**
|
|
```bash
|
|
Open Terminal
|
|
```
|
|
|
|
#### Step 2: Execute the Bootstrap Script
|
|
|
|
> 👋 **Tip**: This command downloads and runs the installer immediately.
|
|
|
|
```bash
|
|
curl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
|
|
```
|
|
|
|
**What this does:**
|
|
- ⬇️ Downloads the installer
|
|
- ▶️ Runs it automatically
|
|
- 🗑️ Cleans up after itself
|
|
|
|
#### Step 3: Accept the Installation
|
|
|
|
The system will warn you that this is **"powerful and inherently risky."**
|
|
- Type `**Yes**` to continue
|
|
- Press `Enter`
|
|
|
|
#### Step 4: Network Configuration
|
|
|
|
You'll be prompted for network settings:
|
|
|
|
```
|
|
**Port:** 18789
|
|
**Bind:** Loopback (127.0.0.1)
|
|
**Tailscale:** Off
|
|
```
|
|
|
|
> 📌 **Note**: You can modify these settings later during the "Gateway port" setup step.
|
|
|
|
### Phase 2: Model Configuration (The Brain)
|
|
|
|
#### Step 1: Select Provider
|
|
|
|
When prompted for the **Model/Auth provider**, select:
|
|
```
|
|
**Z.AI (GLM 4.7)**
|
|
```
|
|
|
|
from the available list.
|
|
|
|
#### Step 2: Authenticate
|
|
|
|
**Select Auth Method:**
|
|
```
|
|
**API Key** (recommended for initial setup)
|
|
```
|
|
|
|
**Enter API Key:**
|
|
```
|
|
Paste your Z.AI API Key when prompted
|
|
```
|
|
|
|
#### Step 3: Confirm Configuration
|
|
|
|
The system will confirm:
|
|
```
|
|
Model configured to 'zai/glm-4.7'
|
|
```
|
|
|
|
### Phase 3: Discord Bot Setup (The Body)
|
|
|
|
#### Step 1: Open Discord Console
|
|
|
|
Launch Discord and navigate to:
|
|
```
|
|
Your Server → Settings → Integrations → Bots
|
|
```
|
|
|
|
#### Step 2: Copy Bot Token
|
|
|
|
1. Click on **OpenClaw** bot
|
|
2. Click **"Copy Token"** (appears when you hover)
|
|
3. Keep this secure!
|
|
|
|
> ⚠️ **Security Alert**: Never share your bot token publicly. Treat it like a password!
|
|
|
|
#### Step 3: Paste Token in Console
|
|
|
|
Return to your command prompt and paste the token when requested.
|
|
|
|
#### Step 4: Channel Configuration
|
|
|
|
Specify which channels the bot can access:
|
|
|
|
```
|
|
Format: */openclaw, [ChannelID]
|
|
```
|
|
|
|
**Example:**
|
|
```
|
|
*/openclaw, 1234567890
|
|
```
|
|
|
|
> 📊 **Tip**: Right-click the channel to "Copy Channel ID"
|
|
|
|
---
|
|
|
|
## 🔍 Testing
|
|
|
|
### Test the Connection
|
|
|
|
1. **Go to your configured Discord channel**
|
|
2. **Mention the bot:**
|
|
```
|
|
@OpenClaw who r u
|
|
```
|
|
3. **Expected Response:** The bot should reply, acknowledging it just came online and asking for a name and personality
|
|
|
|
---
|
|
|
|
## 🚀 Next Steps
|
|
|
|
After successful installation, you can:
|
|
|
|
> 🌈 Customize your bot's personality and configure additional features as needed.
|
|
|
|
---
|
|
|
|
## 🚫 Troubleshooting
|
|
|
|
### Common Issues
|
|
|
|
If you encounter problems:
|
|
|
|
- **🔍 Verify your API key** - Ensure it's correctly entered
|
|
- **✅ Check Discord permissions** - Confirm all required permissions are granted
|
|
- **🌐 Verify port accessibility** - Ensure port 18789 is not blocked by firewall
|
|
- **📂 Enable Message Content Intent** - Required for full functionality in Discord
|
|
|
|
---
|
|
|
|
## 🤝 Contributing
|
|
|
|
Feel free to submit issues or pull requests to improve this guide.
|
|
|
|
---
|
|
|
|
## ⚠️ License & Security Notice
|
|
|
|
### Critical Security Information
|
|
|
|
> 🚨 **SECURITY CRITICAL**: Do NOT use the default port (18789).
|
|
|
|
Many hosts deploy OpenClaw on a VPS with the default port and **zero additional security**. The Risk: If you leave port 18789 open on a public VPS, you are effectively inviting hackers to hijack your bot interface.
|
|
|
|
### Solution
|
|
|
|
**Change the port during the "Gateway port" setup step to something random (e.g., 45912)** and ensure your firewall **only allows traffic from trusted IPs** (or use a VPN/Tailscale).
|
|
|
|
### For More Info
|
|
|
|
See the [LICENSE](LICENSE) file for licensing information.
|
|
|
|
---
|
|
|
|
<div align="center">
|
|
<p><strong>Credit</strong>: <a href="https://discord.com/channels/1346756824233148527/1442045587467072268/1467513064713621678">cobrax91310 on Discord</a> | <a href="https://z.ai/">Z.AI Community</a></p>
|
|
<p><em>Made with ❤️ for the Discord Bot community</em></p>
|
|
</div> |