Home

Awesome

<p align="center"> <a href="https://nonebot.dev/docs/next/best-practice/alconna/"><img src="https://v2.nonebot.dev/logo.png" width="200" height="200" alt="nonebot"></a> </p> <div align="center">

NoneBot Plugin Alconna

✨ Alconna Usage For NoneBot2 ✨

✨ All Receive in One, And One Send All ✨

</div> <p align="center"> <a href="https://raw.githubusercontent.com/nonebot/plugin-alconna/master/LICENSE"> <img src="https://img.shields.io/github/license/nonebot/plugin-alconna.svg" alt="license"> </a> <a href="https://pypi.python.org/pypi/nonebot-plugin-alconna"> <img src="https://img.shields.io/pypi/v/nonebot-plugin-alconna.svg" alt="pypi"> </a> <img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python"> </p>

该插件提供了 AlconnaNoneBot2 适配版本与工具

特性

讨论

QQ 交流群: 链接

使用方法

NoneBot 文档: 📖这里 仓库内介绍: 📦这里

跨平台消息

from nonebot import get_driver
from nonebot_plugin_alconna import Target, UniMessage, SupportScope, on_alconna

driver = get_driver()
test = on_alconna("test")

@test.handle()
async def handle_test():
    r = await UniMessage.image(path="path/to/img").send()
    if r.recallable:
        await r.reply("图片已发送,10秒后撤回")
        await r.recall(delay=10, index=0)

@test.got("foo", prompt=UniMessage.template("{:Reply($message_id)}请输入图片"))
async def handle_foo():
    await test.send("图片已收到")

@driver.on_startup
async def _():
    await Target.group("123456789", SupportScope.qq_client).send(UniMessage.image(path="test.png"))

支持情况

支持的适配器

协议名称路径
OneBot 协议adapters.onebot11, adapters.onebot12
Telegramadapters.telegram
飞书adapters.feishu
GitHubadapters.github
QQ botadapters.qq
钉钉adapters.ding
Consoleadapters.console
开黑啦adapters.kook
Miraiadapters.mirai
Ntchatadapters.ntchat
MineCraftadapters.minecraft
Walle-Qadapters.onebot12
Discordadapters.discord
Red 协议adapters.red
Satoriadapters.satori
Dodo IMadapters.dodo
Kritoradapters.kritor
Tailchatadapters.tailchat
Mailadapters.mail

支持的消息元素

[!WARNING] 斜体的协议名称意味着其协议或其适配器长时间未维护或已失效

元素\适配器OneBot V11OneBot V12Telegram飞书GithubQQ-API钉钉Console开黑啦MiraiNtchatMineCraftDiscordRedSatoriDodo IMKritorTailchatMail
文本 Text
样式文本 Styled Text🚫🚫🚫🚫🚫🚫🚫🚫🚫
提及用户 At(user)⬆️🚫🚫⬆️
提及角色 At(role)🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫
提及频道 At(channel)🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫⬆️
提交全体 AtAll🚫🚫🚫🚫🚫🚫🚫
表情 Emoji🚫🚫🚫🚫🚫🚫🚫🚫🚫
图片 Image⬆️🚫
音频 Audio⬆️🚫🚫🚫⬆️⬇️🚫⬆️⬆️🚫⬆️🚫
语音 Voice⬆️🚫⬆️🚫🚫⬆️⬇️🚫⬆️⬆️🚫🚫
视频 Video🚫🚫🚫🚫⬆️🚫
文件 File⬇️,⬆️(🚧)🚫🚫🚫🚫⬆️⬇️⬇️
回复 Reply🚫🚫🚫🚫
引用转发 Reference🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫🚫
超级消息 Hyper🚫🚫⬇️🚫🚫🚫🚫🚫🚫🚫🚫🚫
按钮 Button🚫🚫⬆️🚫🚫🚫🚫🚫🚫🚫⬆️🚫🚫🚫🚫
其余 Other

配置项

插件示例

demo bot

# echo 插件
from nonebot_plugin_alconna import UniMessage, Command

@Command("echo <...content>").build(auto_send_output=True).handle()
async def _(content: UniMessage):
    await content.finish()