feat: improve QQ channel setup guide and fix botpy intent flags
This commit is contained in:
parent
03d3c69a4a
commit
4f928e9d2a
28
README.md
28
README.md
@ -341,16 +341,24 @@ nanobot gateway
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>QQ (QQ私聊)</b></summary>
|
<summary><b>QQ (QQ单聊)</b></summary>
|
||||||
|
|
||||||
Uses **botpy SDK** with WebSocket — no public IP required.
|
Uses **botpy SDK** with WebSocket — no public IP required. Currently supports **private messages only**.
|
||||||
|
|
||||||
**1. Create a QQ bot**
|
**1. Register & create bot**
|
||||||
- Visit [QQ Open Platform](https://q.qq.com)
|
- Visit [QQ Open Platform](https://q.qq.com) → Register as a developer (personal or enterprise)
|
||||||
- Create a new bot application
|
- Create a new bot application
|
||||||
- Get **AppID** and **Secret** from "Developer Settings"
|
- Go to **开发设置 (Developer Settings)** → copy **AppID** and **AppSecret**
|
||||||
|
|
||||||
**2. Configure**
|
**2. Set up sandbox for testing**
|
||||||
|
- In the bot management console, find **沙箱配置 (Sandbox Config)**
|
||||||
|
- Under **在消息列表配置**, click **添加成员** and add your own QQ number
|
||||||
|
- Once added, scan the bot's QR code with mobile QQ → open the bot profile → tap "发消息" to start chatting
|
||||||
|
|
||||||
|
**3. Configure**
|
||||||
|
|
||||||
|
> - `allowFrom`: Leave empty for public access, or add user openids to restrict. You can find openids in the nanobot logs when a user messages the bot.
|
||||||
|
> - For production: submit a review in the bot console and publish. See [QQ Bot Docs](https://bot.q.qq.com/wiki/) for the full publishing flow.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -365,17 +373,13 @@ Uses **botpy SDK** with WebSocket — no public IP required.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
> `allowFrom`: Leave empty for public access, or add user openids to restrict access.
|
**4. Run**
|
||||||
> Example: `"allowFrom": ["user_openid_1", "user_openid_2"]`
|
|
||||||
|
|
||||||
**3. Run**
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nanobot gateway
|
nanobot gateway
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!TIP]
|
Now send a message to the bot from QQ — it should respond!
|
||||||
> QQ bot currently supports **private messages only**. Group chat support coming soon!
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
def _make_bot_class(channel: "QQChannel") -> "type[botpy.Client]":
|
def _make_bot_class(channel: "QQChannel") -> "type[botpy.Client]":
|
||||||
"""Create a botpy Client subclass bound to the given channel."""
|
"""Create a botpy Client subclass bound to the given channel."""
|
||||||
intents = botpy.Intents(c2c_message=True)
|
intents = botpy.Intents(public_messages=True, direct_message=True)
|
||||||
|
|
||||||
class _Bot(botpy.Client):
|
class _Bot(botpy.Client):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user