Skip to main content

No project description provided

Project description

nonebot-plugin-gocqhttp-cross-machine-upload-file

为go-cqhttp与nonebot部署于不同机器的系统提供上传群文件、私聊文件的能力。

只适用于FastAPI反向驱动器

用法

from io import StringIO

from nonebot import on_startswith, require
from nonebot.adapters.onebot.v11 import Bot, MessageEvent

require("nonebot_plugin_gocqhttp_cross_machine_upload_file")

from nonebot_plugin_gocqhttp_cross_machine_upload_file import upload_file


@on_startswith("test").handle()
async def handle(bot: Bot, event: MessageEvent):
    # 上传指定路径文件
    await upload_file(bot, event, "image.png", path="image.png")

    # 上传打开的IO流
    with StringIO() as f:
        f.write("Hello World")
        f.seek(0)
        await upload_file(bot, event, "hello.txt", f)

    # 上传bytes
    await upload_file(bot, event, "hello.txt", "Hello World".encode())

配置

callback_host

回调HOST,设置为nonebot所在的主机名/IP。务必保证go-cqhttp所在主机可访问,用于让go-cqhttp下载本机文件。

默认值:127.0.0.1

callback_port

回调端口,保持默认值即可。

默认值:与PORT保持一致即可

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file nonebot_plugin_gocqhttp_cross_machine_upload_file-0.1.5.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_gocqhttp_cross_machine_upload_file-0.1.5.tar.gz
Algorithm Hash digest
SHA256 1d0b3551748d47e75dc00ff2ef3851acd158655cfcd599731898857aa205d576
MD5 cb8853b0e9537ab26294ee33d00ad1c6
BLAKE2b-256 60887800a04be91c9e259f8ed8d543af0b252986abd043e9edf6b8db93b86a2b

See more details on using hashes here.

File details

Details for the file nonebot_plugin_gocqhttp_cross_machine_upload_file-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_gocqhttp_cross_machine_upload_file-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ce84fe33e70871875ea0dc70922f6b05cdbb741372581e855eebf1ae0554b636
MD5 f2cca643c9f5519c97d47c1c0f3c3c34
BLAKE2b-256 09acf0e4007625ac21d97342fd6b88e5d65b61f9a29d6fe43f2dad9c7f3c7874

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page