Coder Social home page Coder Social logo

adapter-satori's Introduction

NoneBot

License PyPI Python Version OneBot Version QQ 群 Telegram 频道 Discord Server

简介

NoneBot 是一个基于 OneBot 标准(原 CQHTTP) 的 Python 异步 QQ 机器人框架,它会对 QQ 机器人收到的消息进行解析和处理,并以插件化的形式,分发给消息所对应的命令处理器和自然语言处理器,来完成具体的功能。

除了起到解析消息的作用,NoneBot 还为插件提供了大量实用的预设操作和权限控制机制,尤其对于命令处理器,它更是提供了完善且易用的会话机制和内部调用机制,以分别适应命令的连续交互和插件内部功能复用等需求。

NoneBot 在其底层与 OneBot 实现交互的部分使用 aiocqhttp 库,后者在 Quart 的基础上封装了与 OneBot 实现的网络交互。

得益于 Python 的 asyncio 机制,NoneBot 处理消息的吞吐量有了很大的保障,再配合 OneBot 标准的 WebSocket 通信方式(也是最建议的通信方式),NoneBot 的性能可以达到 HTTP 通信方式的两倍以上,相较于传统同步 I/O 的 HTTP 通信,更是有质的飞跃。

需要注意的是,NoneBot 仅支持 Python 3.7+。

文档

文档目前「指南」和「API」部分已经完成,「进阶」部分尚未完成,你可以在 这里 查看。

贡献

如果你在使用过程中发现任何问题,可以 提交 issue 或自行 fork 修改后提交 pull request。

如果你要提交 pull request,请确保你的代码风格和项目已有的代码保持一致,遵循 PEP 8,变量命名清晰,有适当的注释。

NoneBot

Description

NoneBot is an asynchronous and OneBot-compliant QQ robot framework written in Python. When NoneBot receives new messages, it parses the messages then pass them to user-defined command handlers or natural language processors accordingly using a plugin system to accomplish various tasks.

Beside message processing, NoneBot presents an amount of useful built-in actions and permission handling features. The command processors provide simple but comprehensive session-ing and calling mechanisms to handle continuous interactions and the reusing of functionalities inside plugins, respectively.

NoneBot communicates with OneBot implementations using aiocqhttp, a wrapper based on Quart for lower-level protocol work.

Thanks to asyncio and WebSocket messaging method (which is recommended), NoneBot ensures maximum possible message throughput to be twice as fast as HTTP messaging, and have great performance leap compared to traditional synchronous IO.

NoneBot only supports Python 3.7+.

Documentation

For Guide and API manuals, check out this page.

Contributing

If you encounter any problems in using the project, you can submit an issue or fork this project to submit an pull request.

For pull requests, please be sure to have consistent style to existing modules, follow PEP 8, have clear identifier naming, and have proper comments.

adapter-satori's People

Contributors

eya46 avatar he0119 avatar mobyw avatar rf-tar-railt avatar xiyang6666 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

adapter-satori's Issues

satori怎么@所有人。。我好像没找到相关的实现案例

直接在nonebot的log里抓不到相关的信息。

[message-created]: Message 7447092827256596462 from 我...我才不是机器人(817340530)@[测试靶场:817340530]: [Text(type='text', data={'text': ' ', 'styles': {}}, _children=[])]

在cc的开发文档里推荐的postman也抓不到相关信息。

{
    "op": 0,
    "body": {
        "id": 322,
        "type": "message-created",
        "platform": "chronocat",
        "self_id": "1021009873",
        "timestamp": 1716631417000,
        "user": {
            "id": "1021009873",
            "name": "我...我才不是机器人",
            "avatar": "http://thirdqq.qlogo.cn/headimg_dl?dst_uin=1021009873&spec=640"
        },
        "channel": {
            "type": 0,
            "id": "817340530",
            "name": "测试靶场"
        },
        "guild": {
            "id": "817340530",
            "name": "测试靶场",
            "avatar": "https://p.qlogo.cn/gh/817340530/817340530/640"
        },
        "member": {},
        "message": {
            "id": "7447092827256596462",
            "content": " "
        }
    }
}

[Bug] 在nonebot2.2下启动就报错

请确认:

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个Bug

Bug

问题

在nonebot2.2下启动就报错

如何复现

在存在nonebot2.2.0包的情况下导入Adapter

预期行为

使用环境:

  • 操作系统 (Windows/Linux/Mac): Windows
  • Python 版本: 3.12.1
  • Nonebot2 版本: 2.2.0
  • 适配器版本: 0.8.3
  • 使用的 Satori 服务端 (例如 Chronocat):

日志/截图

C:\Users\Neneka\Desktop\draft\testbot_pypackages_\3.12\lib\pydantic_migration.py:283: UserWarning: pydantic.generics:GenericModel has been moved to pydantic.BaseModel.
warnings.warn(f'{import_path} has been moved to {new_location}.')
Traceback (most recent call last):
File "C:\Users\Neneka\Desktop\draft\testbot\bot.py", line 2, in
from nonebot.adapters.satori import Adapter as SatoriAdapter
File "C:\Users\Neneka\Desktop\draft\testbot_pypackages_\3.12\lib\nonebot\adapters\satori_init_.py", line 1, in
from .bot import Bot as Bot
File "C:\Users\Neneka\Desktop\draft\testbot_pypackages_\3.12\lib\nonebot\adapters\satori\bot.py", line 13, in
from .event import Event, MessageEvent
File "C:\Users\Neneka\Desktop\draft\testbot_pypackages_\3.12\lib\nonebot\adapters\satori\event.py", line 378, in
class ReactionEvent(NoticeEvent):
File "C:\Users\Neneka\Desktop\draft\testbot_pypackages_\3.12\lib\nonebot\adapters\satori\event.py", line 394, in ReactionEvent
@root_validator
^^^^^^^^^^^^^^
File "C:\Users\Neneka\Desktop\draft\testbot_pypackages_\3.12\lib\pydantic\deprecated\class_validators.py", line 231, in root_validator
return root_validator()(*_args) # type: ignore
^^^^^^^^^^^^^^^^
File "C:\Users\Neneka\Desktop\draft\testbot_pypackages
\3.12\lib\pydantic\deprecated\class_validators.py", line 237, in root_validator
raise PydanticUserError(
pydantic.errors.PydanticUserError: If you use @root_validator with pre=False (the default) you MUST specify skip_on_failure=True. Note that @root_validator is deprecated and should be replaced with @model_validator.

[Bug]: 请问是没有主动群消息发送的接口吗

确认项

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个 Bug
  • 我已经尝试过在最新的代码中修复这个问题

操作系统

Windows

Python 版本

3.11

NoneBot 版本

2.0.0

适配器

0.1

协议端

cc

描述问题

如题
好像是[Satori]本身把channel_create这个给禁止了,所以是不是没办法主动发送群消息

复现步骤

如题

期望的结果

No response

截图或日志

No response

Nonebot 配置项

No response

[Bug]:

确认项

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个 Bug
  • 我已经尝试过在最新的代码中修复这个问题

操作系统

Windows

Python 版本

3.12.3

NoneBot 版本

2.2.1

适配器

0.10.5

协议端

Chronocat/0.2.9

描述问题

url1 = https://i.pixiv.cat/user-profile/img/2019/06/08/18/15/46/15864250_3a16ed5563079c651f041ee27950de74_170.png
url2 = https://tse2-mm.cn.bing.net/th/id/OIP-C.zRGpb4aW12GQGH5L3_sz-wHaHa?rs=1&pid=ImgDetMain

send_message发送图片信息时,url1请求失败(超时),url2正常发送。在不开代理的情况下,两个url都能正常访问(包括浏览器和requests)。

复现步骤

1.对上述url用Messagesegment类下的Image.image构建图片信息;
2.用matcher.sendbot.send_message发送图片信息;
3.url2 的消息正常发送,url1的信息报错如下:
图1为nonebot的log
1
图2为chronocat的log
2

期望的结果

No response

截图或日志

No response

Nonebot 配置项

No response

[Bug]: 发送消息 'NoneType' object is not iterable

确认项

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个 Bug
  • 我已经尝试过在最新的代码中修复这个问题

操作系统

Windows

Python 版本

3.10

NoneBot 版本

2.3.1

适配器

0.12.0

协议端

Chronocat 0.2.10

描述问题

发送消息时报错:

06-13 16:04:15 [ERROR] nonebot | Running Matcher(type='message', module=src.plugins.dead_or_not, lineno=5) failed.
Traceback (most recent call last):
  File "D:\Desktop\pytech\bot\haybot\bot.py", line 16, in <module>
    nonebot.run()
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\drivers\none.py", line 56, in run
    loop.run_until_complete(self._serve())
  File "D:\Python\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "D:\Python\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "D:\Python\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "D:\Python\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "D:\Python\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run
    await handler(
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "D:\Desktop\pytech\bot\haybot\src\plugins\dead_or_not\__init__.py", line 10, in start
    await dead_or_not.send(message="你才死了,吵什么吵")
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 566, in send
    return await bot.send(event=event, message=_message, **kwargs)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\bot.py", line 256, in send
    return await self.send_message(event.channel.id, message)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\bot.py", line 270, in send_message
    return await self.message_create(channel_id=channel_id, content=str(message))
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\adapter\bot.py", line 122, in call_api
    raise exception
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\internal\adapter\bot.py", line 97, in call_api
    result = await self.adapter._call_api(self, api, **data)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\adapter.py", line 283, in _call_api
    return await api_handler(bot, **data)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\utils.py", line 39, in __call__
    return await self.func(inst, *args, **kwds)
  File "D:\Desktop\pytech\bot\haybot\.venv\lib\site-packages\nonebot\adapters\satori\bot.py", line 316, in message_create
    return [type_validate_python(SatoriMessage, i) for i in res]
TypeError: 'NoneType' object is not iterable

该报错不影响正常回复。将adapter-satori回退至0.11.5后不会出现此报错。

复现步骤

该错误由一个非常简单的插件引发:

dead_or_not = on_command("dead_or_not", rule=to_me(), aliases={"死了吗", "死了没"}, priority=4)

@dead_or_not.handle()
async def start():
    await dead_or_not.finish(message="你才死了,吵什么吵")

期望的结果

No response

截图或日志

No response

Nonebot 配置项

No response

[Bug] 发送本地绝对路径格式的图片无返回值

请确认:

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个Bug

Bug

问题

发送图片接口中,将url指定为file:///格式的本地绝对路径,create_message无返回值

如何复现

后端为adapter-satori, 协议端为chronocat 0.52,仅本地路径形式的图片发送存在问题

预期行为

可以使用绝对路径发送,例如:{'type': 'img', 'data': {'src': 'file:///C:\Users\Public\gocqhttp\data\images\817815373\a75d121be086f93df202810d311b70df.gif'}}

使用环境:

  • 操作系统 (Windows/Linux/Mac): Windows 11
  • Python 版本: python3.11
  • Nonebot2 版本: 2.1.1
  • 适配器版本: 0.8.1
  • 使用的 Satori 服务端 (例如 Chronocat): Chronocat 0.52

日志/截图

12-13 16:59:48 [INFO] nonebot | Matcher(type='message', module=iCore.bot.interpreter, lineno=171) running complete
{'type': 'img', 'data': {'src': 'file:///C:\Users\Public\gocqhttp\data\images\817815373\a75d121be086f93df202810d311b70df.gif'}}
request is: Request(method='POST', url='http://localhost:5500/v1/message.create')
content is
12-13 16:59:49 [WARNING] apscheduler | Execution of job "none_bot_work_queue (trigger: interval[0:00:01], next run at: 2023-12-13 16:59:49 CST)" skipped: maximum number of running instances reached (1)
12-13 16:59:50 [WARNING] apscheduler | Execution of job "none_bot_work_queue (trigger: interval[0:00:01], next run at: 2023-12-13 16:59:50 CST)" skipped: maximum number of running instances reached (1)
12-13 16:59:51 [INFO] nonebot | Event will be handled by Matcher(type='message', module=iCore.bot.interpreter, lineno=171)
12-13 16:59:51 [INFO] nonebot | Matcher(type='message', module=iCore.bot.interpreter, lineno=171) running complete
res is []
image

[Bug]: Satori Adapter不支持使用Nonebot Alconna解析命令

确认项

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个 Bug
  • 我已经尝试过在最新的代码中修复这个问题

操作系统

Windows

Python 版本

3.12.2

NoneBot 版本

2.2.1

适配器

0.10.1

协议端

Chronocat

描述问题

使用on_alconna构造的事件响应器报错并提示Message Exporter not found under adapter Satori

复现步骤

  1. 使用QQNT和LiteLoader启用Choronocat
  2. bot正常连接并加载插件
  3. 触发使用on_alconna构造的事件响应器即会报错

期望的结果

No response

截图或日志

1.事件响应器定义:
image
2.处理函数定义:
image
3.Traceback:
image

Nonebot 配置项

No response

[Bug] Bot接收群组成员增加事件时程序报错

请确认:

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个Bug

Bug

问题

Bot接收群组成员增加事件时程序报错

如何复现

在群聊中邀请Bot账号加入群聊,事件响应器注入GuildInnerMemberAddedEvent事件(即Bot加入新群聊产生的事件)无法被正常解析

预期行为

事件响应器正常解析GuildInnerMemberAddedEvent事件

使用环境:

  • 操作系统 (Windows/Linux/Mac): Windows
  • Python 版本: python3.10
  • Nonebot2 版本: 2.1.1
  • 适配器版本: 0.6.1
  • 使用的 Satori 服务端 (例如 Chronocat): Chronocat

日志/截图

image

image

尝试将代码中 event.py 中的第135行注释可正常使用事件响应器

[Feature]

请确认:

  • 新特性的目的明确
  • 我已经阅读了相关文档 并且找不到类似特性

Feature

概要

能够自定义path

是否已有相关实现

暂无

其他内容

e233b2a05d7f613c2012c361137d49ac
229857755c37e0b6cb35a7c795bd77be
0e44439b7b5fe2b5f782ace6be51254a
e20f9428aa0612c5f378b633bbf39833
b769906110dd0264c3622c70c9396d0e
使用的koishi的server插件,但是会报 Cannot connect to host 127.0.0.1:5501 ssl:default [远程计算机拒绝网络连接。]大佬叫我提个iss

[Bug] ChannelType 枚举定义与协议不符

请确认:

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个Bug

适配器:

class ChannelType(IntEnum):
TEXT = 0
VOICE = 1
CATEGORY = 2
DIRECT = 3

协议:
https://github.com/satorijs/satori/blob/4dbb6296b09a29ec60554a94109f537c652d12aa/packages/protocol/src/index.ts#L147-L154
https://satori.chat/zh-CN/resources/channel.html#channel-type

[Bug] 收到任何quote消息均会触发to_me

请确认:

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个Bug

Bug

问题

收到任何quote消息均会触发to_me

如何复现

连接 chronocat 0.0.71 , 当接受到包含 quote 的消息时无论被引用的消息由谁发出均会触发 to_me

预期行为

仅当quote引用的消息由bot发出时触发to_me

使用环境:

  • 操作系统 (Windows/Linux/Mac): Windows
  • Python 版本: 3.8.10
  • Nonebot2 版本: 2.1.3
  • 适配器版本: 0.8.2
  • 使用的 Satori 服务端 (例如 Chronocat): chronocat v0.0.71

日志/截图

image image

[Bug]: 使用MessageSegment消息段与其它消息段或文本组合时,特殊字符会消失?

确认项

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个 Bug
  • 我已经尝试过在最新的代码中修复这个问题

操作系统

Windows

Python 版本

3.8.10

NoneBot 版本

2.2.1

适配器

0.11.2

协议端

Chronocat 0.2.6

描述问题

使用MessageSegment消息段与其它消息段或文本组合时,特殊字符会消失?
我尝试过nonebot文档给出的其它组合方式,但是除了文本与文本之间的组合,其它的组合都没有识别出转义字符。

复现步骤

这是其中的部分代码:
from nonebot import on_startswith
from nonebot.adapters.satori import Message, MessageEvent, MessageSegment

menu_get = on_startswith({"菜单"})

@menu_get.handle()
async def Mint_menu(bot: Bot,event:MessageEvent):
test_message1 = MessageSegment(type="chronocat:face",data={"id":12}) + "\n" + "Hello Yoshi"
test_message2 = [MessageSegment(type="chronocat:face",data={"id":12}),MessageSegment.text("\n"),MessageSegment.text("Hello Yoshi")]
test_message3 = [MessageSegment.text("[CQ:face,id=12]"),MessageSegment.text("\n"),MessageSegment.text("Hello Yoshi")]
test_message4 = [MessageSegment("[CQ:face,id=12]"),MessageSegment.text("\n"),MessageSegment.text("Hello Yoshi")]
test_message5 = ["[CQ:face,id=12]","\n",MessageSegment.text("Hello Yoshi")]
print(test_message1)
print(test_message2)
print(test_message3)
print(test_message4)
print(test_message5)
await menu_get.send(Message(test_message1))
await menu_get.send(Message(test_message2))
await menu_get.send(Message(test_message3))
await menu_get.send(Message(test_message4))
await menu_get.send(Message(test_message5))
await menu_get.finish()

期望的结果

转义的字符能够正常显示

截图或日志

print(test_message1)的情况:
image
print(Message(test_message1))的情况:
image

Nonebot 配置项

No response

[Feature] satori是否不支持发送群组消息,能否支持该功能

请确认:

  • 新特性的目的明确
  • 我已经阅读了相关文档 并且找不到类似特性

Feature

概要

发送群组消息

是否已有相关实现

暂无

其他内容

(nonebot_env) lmx@3500x:~/blive_push$ nb run --reload
Started reloader with process [1608766].
05-18 17:34:09 [SUCCESS] nonebot | NoneBot is initializing...
05-18 17:34:09 [INFO] nonebot | Current Env: prod
05-18 17:34:10 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
05-18 17:34:10 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
05-18 17:34:10 [INFO] nonebot-plugin-bilibili-notifier | 加载上次更新时间2024-05-18 17:26:36(1716053196)
05-18 17:34:10 [INFO] nonebot-plugin-bilibili-notifier | 推送更新消息的用户:群:
05-18 17:34:10 [INFO] nonebot-plugin-bilibili-notifier | 推送直播消息的用户:群:
05-18 17:34:10 [INFO] nonebot-plugin-bilibili-notifier | 屏蔽的消息/群:{}
05-18 17:34:10 [SUCCESS] nonebot | Succeeded to load plugin "config" from "nonebot-plugin-bilibili-notifier.nonebot_plugin_bilibili_notifier.config"
05-18 17:34:10 [SUCCESS] nonebot | Running NoneBot...
05-18 17:34:10 [INFO] uvicorn | Started server process [1608766]
05-18 17:34:10 [INFO] uvicorn | Waiting for application startup.
05-18 17:34:10 [INFO] nonebot_plugin_apscheduler | Scheduler Started
05-18 17:34:10 [INFO] uvicorn | Application startup complete.
05-18 17:34:10 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit)
05-18 17:34:10 [INFO] nonebot | Satori | Bot 1021009873 connected

05-18 17:35:00 [INFO] nonebot-plugin-bilibili-notifier | 将3546377921497768的更新推送到123456789
****** 发布动态:test
https://www.bilibili.com/opus/
05-18 17:35:00 [ERROR] apscheduler | Job "fetch_bilibili_updates (trigger: cron[second='0'], next run at: 2024-05-19 01:36:00 CST)" raised an exception
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "/home/lmx/nonebot_env/lib/python3.10/site-packages/nonebot/__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "/home/lmx/nonebot_env/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run
    uvicorn.run(
  File "/home/lmx/nonebot_env/lib/python3.10/site-packages/uvicorn/main.py", line 575, in run
    server.run()
  File "/home/lmx/nonebot_env/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
> File "/home/lmx/nonebot_env/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
    retval = await job.func(*job.args, **job.kwargs)
  File "/home/lmx/blive_push/nonebot-plugin-bilibili-notifier/nonebot_plugin_bilibili_notifier/__init__.py", line 162, in fetch_bilibili_updates
    await bot.send_group_msg(guild_id=gid, message=msg)
  File "/home/lmx/nonebot_env/lib/python3.10/site-packages/nonebot/adapters/satori/bot.py", line 163, in __getattr__
    raise AttributeError(f"'Bot' object has no attribute '{item}'")
AttributeError: 'Bot' object has no attribute 'send_group_msg'

[Feature]: 添加一个使用文档吧

确认项

  • 新特性的目的明确
  • 我已经使用过该项目并且了解其功能

希望能解决的问题

添加一个使用文档吧

描述所需要的功能

添加一个使用文档吧

[Bug]: QQ群消息中user_id等同于guild_id

确认项

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个 Bug
  • 我已经尝试过在最新的代码中修复这个问题

操作系统

Windows

Python 版本

3.10

NoneBot 版本

2.3.1

适配器

0.11.5

协议端

Chronocat 0.2.10

描述问题

接收群消息事件时,用户id与群组id相同,为群组id的值。

复现步骤

正常启动最新版QQNT(9.9.11)+LiteloaderQQNT(1.1.1)+Chronocat(0.2.10),成功连接nonebot

期望的结果

No response

截图或日志

一次启动例:

(nonebot2) D:\Desktop\pytech\bot\haybot>python bot.py
06-05 13:15:07 [SUCCESS] nonebot | NoneBot is initializing...
06-05 13:15:07 [INFO] nonebot | Current Env: prod
06-05 13:15:07 [SUCCESS] nonebot | Succeeded to load plugin "echo" from "nonebot.plugins.echo"
06-05 13:15:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
06-05 13:15:08 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_orm"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_session"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_session_orm"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_chatrecorder"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "dead_or_not" from "src.plugins.dead_or_not"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "random_dice" from "src.plugins.random_dice"
06-05 13:15:09 [SUCCESS] nonebot | Succeeded to load plugin "bible_game" from "src.plugins.bible_game"
06-05 13:15:10 [SUCCESS] nonebot | Succeeded to load plugin "yiyan_ernie" from "src.plugins.yiyan_ernie"
06-05 13:15:10 [SUCCESS] nonebot | Running NoneBot...
06-05 13:15:10 [INFO] nonebot_plugin_orm | 没有检测到新的升级操作
06-05 13:15:10 [INFO] nonebot | Application startup completed.
06-05 13:15:12 [INFO] nonebot | Satori | Bot 172****019 connected
06-05 13:15:39 [SUCCESS] nonebot | Satori 172****019 | [message-created]: Message 7376883****15935406 from ChanceLetHay(371****187)@[NostalgicCover:371****187]: [Text(type='text', data={'text': '搞什么', 'styles': {}}, _children=[])]
06-05 13:15:41 [SUCCESS] nonebot | Satori 172****019 | [message-created]: Message 7376883****08027905 from (371****187)@[NostalgicCover:371****187]: [Text(type='text', data={'text': '我怎么也没看明白', 'styles': {}}, _children=[])]

log

Nonebot 配置项

DRIVER=~aiohttp

[Bug] 使用httpx且token为空时报错

请确认:

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个Bug

Bug

问题

httpx.LocalProtocolError: Illegal header value b'Bearer '

[Bug] bot.send(str) 无法自动转义特殊字符

请确认:

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个Bug

Bug

问题

send 传入 str 时特殊字符未被转义
(使用MessageSegment.text(str)包装后可以自动转义)

如何复现

help_msg = 'command usage: /some_cmd <required_arg> [optional_arg]'
await matcher.finish(help_msg)

收到的是

command usage: /some_cmd  [optional_arg]

预期行为

使用环境:

  • 操作系统 (Windows/Linux/Mac):
  • Python 版本: 3.12.1
  • Nonebot2 版本: 2.1.3
  • 适配器版本: 0.8.3
  • 使用的 Satori 服务端 (例如 Chronocat):

日志/截图

[Feature] 命令起始字符自定义

请确认:

  • [√] 新特性的目的明确
  • [√] 我已经阅读了相关文档 并且找不到类似特性

Feature

概要

希望加入命令起始字符适配功能,目前只能@nickname/命令

是否已有相关实现

暂无

其他内容

暂无

[Bug]: pydantic 版本为1.10.14 启动时报错

确认项

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个 Bug
  • 我已经尝试过在最新的代码中修复这个问题

操作系统

Windows

Python 版本

3.10.4

NoneBot 版本

2.3.0

适配器

0.12.2

协议端

Chronocat

描述问题

pydantic 版本是1.10.14
启动时发生报错 升级到 PYDANTIC_V2 后不发生报错

Traceback (most recent call last):
  File "C:\bot\miyuki\bot.py", line 7, in <module>
    from nonebot.adapters.satori import Adapter as SATORIAdapter
  File "C:\bot\miyuki\venv\lib\site-packages\nonebot\adapters\satori\__init__.py", line 1, in <module>
    from .bot import Bot as Bot
  File "C:\bot\miyuki\venv\lib\site-packages\nonebot\adapters\satori\bot.py", line 145, in <module>
    class Bot(BaseBot):
  File "C:\bot\miyuki\venv\lib\site-packages\nonebot\adapters\satori\bot.py", line 365, in Bot
    ) -> PageDequeResult[SatoriMessage]:
  File "C:\bot\miyuki\venv\lib\site-packages\pydantic\generics.py", line 106, in __class_getitem__
    check_parameters_count(cls, params)
  File "C:\bot\miyuki\venv\lib\site-packages\pydantic\generics.py", line 338, in check_parameters_count
    raise TypeError(f'Too {description} parameters for {cls.__name__}; actual {actual}, expected {expected}')
TypeError: Too many parameters for PageDequeResult; actual 1, expected 0

复现步骤

启动初始化时报错

期望的结果

No response

截图或日志

No response

Nonebot 配置项

No response

[Bug]: 接收到带有at机器人的命令无法通过nonebot.rule自带的to_me()响应规则检查

确认项

  • 问题的标题明确
  • 我翻阅过其他的 issue 并且找不到类似的问题
  • 我已经阅读了相关文档 并仍然认为这是一个 Bug
  • 我已经尝试过在最新的代码中修复这个问题

操作系统

Windows

Python 版本

3.12.2

NoneBot 版本

2.2.1

适配器

0.10.5

协议端

Chronocat

描述问题

使用on_command(..., rule=to_me(), ...)构建的事件响应器无法被带有at机器人的命令消息触发
我同时尝试使用用@bot /cmd arg@bot cmd arg的形式发送指令,都无法触发

复现步骤

参见截图中的实例

期望的结果

No response

截图或日志

  1. 带有rule=to_me()的事件响应器和处理函数:
    image
    image
  2. 尝试触发命令,失败(中间是打印的event.message.content)
image 3. 不带`rule=to_me()`的事件响应器和处理函数: ![image](https://github.com/nonebot/adapter-satori/assets/38141753/ff79aa5e-9941-420b-9818-ef2dfff00c89) ![image](https://github.com/nonebot/adapter-satori/assets/38141753/60ff1e37-717f-42cd-ae76-81d78456ec67) 4. 尝试触发命令,成功: image

Nonebot 配置项

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.