Skip to main content

nonebot

NoneBot-Adapter-YunHu

✨ YunHu adapter for NoneBot2 ✨

PyPI GitHub

支持情况

事件支持情况

  • 基础消息事件
  • 按钮事件上报接收
  • 机器人设置事件
  • 按钮发送
  • 表单接收

支持的消息元素

元素 支持情况
文本 Text ✅
图片 Image ✅
提及用户 At(user) ✅
按钮 Buttons ✅
表单 Form ⬇️
表情包 expression ⬇️
语音 Audio ⬇️
视频 Video ✅
文件 File ✅
HTML HTML ✅
文章 Post ⬇️
Markdown ✅
提示信息 Tip ⬇️
回复 Reply ✅

支持的消息操作

操作 支持情况
发送 Send ✅
撤回 Recall ✅
编辑 Edit ✅
表情响应 Reaction 🚫

简介

nonebot-adapter-yunhu 是为 NoneBot2 设计的云湖(YunHu)平台适配器,支持开发云湖机器人,提供完整的消息和服务支持。

安装

使用 pip 安装

pip install nonebot-adapter-yunhu

使用 nb-cli 安装

nb adapter install nonebot-adapter-yunhu

使用 poetry 安装

poetry add nonebot-adapter-yunhu

配置

在您的 NoneBot 项目配置文件 .env 中添加以下配置:

app_id 是 Bot 的 ID,可在 bot 信息页面查看

DRIVER=~fastapi+~httpx

YUNHU_BOTS = '[{
    "app_id": "123456",
    "token": "xxx",
}
]
'

HOST = 0.0.0.0
PORT = 8080

在 bot.py 中注册适配器:

import nonebot
from nonebot.adapters.yunhu import Adapter as YunhuAdapter

nonebot.init()

driver = nonebot.get_driver()
driver.register_adapter(YunhuAdapter)

在云湖控制台,上报地址为 http(s)://{HOST}:{PORT}/yunhu/{app_id}

使用方法

基本用法

from nonebot import on_command
from nonebot.adapters.yunhu import Bot, Event

echo = on_command("echo")

@echo.handle()
async def handle_echo(bot: Bot, event: Event):
    await echo.finish(event.get_message())

发送不同类型的消息

具体类型参考 message.py

from nonebot import on_command
from nonebot.adapters.yunhu import Bot, Event, MessageSegment

test = on_command("test")

@test.handle()
async def handle_send_image(bot: Bot, event: Event):
    # 发送文本
    await test.send(MessageSegment.text("Hello World"))
    # 发送图片, 也可以直接传参 raw=bytes 或 raw="imageKey"
    await test.send(MessageSegment.image(url="xxxxx"))
    # @某人
    await test.send(MessageSegment.at("user_id"))

获取帮助

image

  • 加入云湖群聊【NoneBot 云湖适配器交流群】: 链接
  • 群 ID: 519215204

相关链接

Metadata

Release files for nonebot-adapter-yunhu 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-adapter-yunhu 0.1.6
File Size Uploaded
nonebot_adapter_yunhu-0.1.6.tar.gz 24.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-adapter-yunhu 0.1.6
File Interpreter ABI Platform
nonebot_adapter_yunhu-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 52.2 kB

Release files / nonebot_adapter_yunhu-0.1.6.tar.gz

Download URL nonebot_adapter_yunhu-0.1.6.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b03bc43810c2121dcc1cec3fc67547a21ac8dcf1b8c7965f351f591f1333c02f
BLAKE2b-256 checksum
How to use checksums
cb6e54a28c433f1503e5ed3aea1840ccedcb6e7784b64027aab6af0b924945b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.1 CPython/3.14.2 Linux/6.11.0-1018-azure

Release files / nonebot_adapter_yunhu-0.1.6-py3-none-any.whl

Download URL nonebot_adapter_yunhu-0.1.6-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
703acd7b23e9c7d1b6ffeb2389cd5a06cd27135d99422083e437fa5d0639e208
BLAKE2b-256 checksum
How to use checksums
aff5e2c27050f23ef4340b97255a6b124ce025f4b4373630434970a6e6717755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.1 CPython/3.14.2 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page