Red Protocol Adapter for Nonebot2
Project description
NoneBot-Adapter-Red
✨ NoneBot2 Red Protocol适配器 / Red Protocol Adapter for NoneBot2 ✨
安装
Chronocat
请按照 Chronocat 的指引安装。
配置
修改 NoneBot 配置文件 .env
或者 .env.*
。
Driver
参考 driver 配置项,添加 ForwardDriver
支持。
如:
DRIVER=~httpx+~websockets
DRIVER=~aiohttp
RED_BOTS
配置机器人帐号,如:
RED_BOTS='
[
{
"port": "xxx",
"token": "xxx",
"host": "xxx"
}
]
'
其中 port
暂时一律为 16530
token
被默认存储在 %AppData%/BetterUniverse/QQNT/RED_PROTOCOL_TOKEN 或 ~/BetterUniverse/QQNT/RED_PROTOCOL_TOKEN 中,
首次启动 Chronocat 时会自动生成,并保持不变。
host
为运行 QQNT 的设备主机,默认为 localhost
。
功能
支持的事件:
- 群聊消息、好友消息 (能够接收到来着不同设备的自己的消息)
- 群名称改动事件
- 群成员禁言/解除禁言事件
- 群成员加入事件 (包括旧版受邀请入群)
支持的 api:
- 发送消息 (文字,at,图片,文件,表情,引用回复)
- 发送伪造合并转发 (文字,at,图片)
- 获取自身资料
- 获取好友、群组、群组内群员资料
- 获取群公告
- 禁言/解禁群员
- 全体禁言
- 获取历史消息
- 获取媒体消息的原始数据
完整的 api 文档请参考 API 文档 或 QQNTRedProtocol
示例
from pathlib import Path
from nonebot import on_command
from nonebot.adapters.red import Bot
from nonebot.adapters.red.event import MessageEvent
from nonebot.adapters.red.message import MessageSegment
matcher = on_command("test")
@matcher.handle()
async def handle_receive(bot: Bot, event: MessageEvent):
await bot.send_group_message(event.scene, MessageSegment.image(Path("path/to/img.jpg")))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nonebot_adapter_red-0.2.1.tar.gz
(19.3 kB
view hashes)
Built Distribution
Close
Hashes for nonebot_adapter_red-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e467b8f5adb6db4aca1725c2a05ae8d8a5b0915aa66c1cc1d8b28b74dd0b5581 |
|
MD5 | 859b1d49a0cb75aab51fc8bff94f223d |
|
BLAKE2b-256 | e1b2f8024c9a0c88a2bf7e149acc455d2ab340df1122e0b1aae36cc4b62a9a1c |
Close
Hashes for nonebot_adapter_red-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d5848076a3845c3cae12c92ad61e938adf62e82da6d6b55e98b2647dd14e93e |
|
MD5 | c174e9aee402334c283906a51754c401 |
|
BLAKE2b-256 | 58b06fee80383a4fa8e84091abfef97379032126f0bd009709c20ce1544993c5 |