Skip to main content

nonebot-plugin-saalc

✨ 使用 SAA 风格混合发送 SAA 和 alc 的消息 ✨

license pypi python

介绍

saalc 提供SAA自有消息段与 plugin-alconna.uniseg 的兼容。允许同时使用 SAA 和 plugin-alconna.uniseg。

UniMessageFactory 继承自 SAA 的 MessageFactory,与原有的 MessageFactory 用法基本一致,只是可以混合使用 nonebot_plugin_alconna 和 nonebot_plugin_saa 的消息段类型(包括SAA不支持的消息段类型)

from nonebot_plugin_alconna import Text as AlcText, Image as AlcImage, UniMessage, File as AlcFile
from nonebot_plugin_saa import Text as SaaText, Image as SaaImage
from nonebot_plugin_saa.ext.uniseg import UniMessageFactory

@a_matcher.handle()
async def some():
    # 混合使用
    umf = UniMessageFactory(
        [
            AlcText("alc"),
            SaaText("saa"),
            AlcImage(url="https://al.c/image.png"),
            SaaImage("https://sa.a/image.png")
        ]
    )

    await umf.send()

    # 从 UniMessage 转换
    um = UniMessage(
        [
            AlcText("alc"),
            AlcImage(url="https://al.c/image.png"),
        ]
    )
    umf = UniMessageFactory.from_unimsg(um)
    await umf.send()

    # 混用 SAA 不支持的 File 消息段
    umf = UniMessageFactory(
        [
            SaaText("alc"),
            AlcFile(url="https://al.c/file.zip"),
        ]
    )
    await umf.send()

兼容性

如果想在现有的 SAA 项目中使用 plugin-alconna.uniseg,可以直接导入 UniMessageFactory 来发送消息 只需要这样做:

from nonebot_plugin_saalc import UniMessageFactory as MessageFactory

就可以基本无缝地替换原有的 MessageFactory。不保证,但你可以提 Issue 甚至 Pull Request 是吧(

saalc 是基于 SAA 的功能扩展,其范围基本以 SAA 的功能为主,saalc 中所提供功能范围的取决情况:

功能 SAA alc
消息段范围 ✅ ✅
平台目标 ✅
消息回执 ✅
消息 ID ✅

安装方法

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-saalc
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot-plugin-saalc
pdm
pdm add nonebot-plugin-saalc
poetry
poetry add nonebot-plugin-saalc

打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入

plugins = ["nonebot_plugin_template"]

相关项目

Metadata

Release files for nonebot-plugin-saalc 0.1.1

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-plugin-saalc 0.1.1
File Size Uploaded Provenance
nonebot_plugin_saalc-0.1.1.tar.gz 8.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-saalc 0.1.1
File Interpreter ABI Platform
nonebot_plugin_saalc-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / nonebot_plugin_saalc-0.1.1.tar.gz

Download URL nonebot_plugin_saalc-0.1.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a7fa6c35a8d3818d48e282e525ef6e8e41d58b8e382e8a49d79fa9c4c8b75bf0
BLAKE2b-256 checksum
How to use checksums
8575b0398fb421c70639f2109ab3f8e00e8ae823a9d46548d828eba23a6fb837
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.15.4 CPython/3.10.12 Linux/6.5.0-1021-azure

Release files / nonebot_plugin_saalc-0.1.1-py3-none-any.whl

Download URL nonebot_plugin_saalc-0.1.1-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d39cfe71a3bafc6c16a7b42b089066528f649045ec3bbc761218b16af44d8f82
BLAKE2b-256 checksum
How to use checksums
422c20a94a63603b783fe75d84199abe1fb621d02811ee4c8ad1178a180eb0ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.15.4 CPython/3.10.12 Linux/6.5.0-1021-azure

Security for nonebot-plugin-saalc 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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