Comments (4)
转义这个问题我写的时候是有考虑的,对于发送消息(echo),因为用的是我另一个 coolq-http-api,我直接用了 is_raw
参数让他来自己转义,对于接收的消息,我当时想的是如果把编码后的字符再转回来可能会和 CQ 码混淆,不过现在想来这个可能是有点问题。
你能自己改当然最好啦~我其实感觉这个适配器这边我写的有点乱,对不同平台的适配基本上是凭直觉写,我想后面有时间的话要设计一套通用接口,包括发送、接收的那种,把图片、语音之类的消息格式也支持进来,这样也就不会出现 CQ 码转义的问题了;以及这个整体的程序框架可能也要重构一下。
如果你有兴趣的话我们到时候可以讨论讨论,不过可能要过一段时间,最近在忙一些别的事情。
最后也感谢你的支持~
from nonebot.
嗯,我看到is_raw参数时也想到你可能是把转义的处理留给应用自己去解决了,只不过应用中去解决要么是通过一个统一的filter和echo来处理,要么散落在各个模块或函数中,这样都不如adapter来处理更加合适
我自己的代码会尽量保持独立,避免与你的框架产生耦合,等你忙完重构时我们可以讨论一些其他优化的地方,我先把想到的都已issue方式记录下来
from nonebot.
嗯嗯,另外 is_raw
是在调用 /send_private_msg
这个接口时候传的,对 xiaokai-bot 的插件是隐藏的,其实跟直接在 adapter 里转义是一样的了,其实也无所谓。
from nonebot.
现在发送消息时候,直接由调用者处理消息的格式了(包括 CQ 码),由于 aiocqhttp
提供了 Message
和 MessageSegment
类,使用已经足够方便了,再加上 none
提供了 expression 的支持(在一些表达方式中随机一个进行格式化,或调用函数生成,具体文档有空会写)。另外现在已经没有适配器了,完全依赖于酷 Q,因为实在精力有限,而且 CoolQ HTTP API 已经比较完善了。
这个 issue 先关了,内容已经和最新的 NoneBot 关联不大了。
from nonebot.
Related Issues (20)
- 请问如何在只是User is calling me的情况下保持会话? HOT 2
- scheduler与message_preprocessor不在同一个eventloop导致两者之间很难进行同步 HOT 6
- nonebot+cqhttp反向websocket 时出现错误: websocket: bad handshake HOT 8
- [提问]如何关闭heartbeat的logging HOT 6
- aget 无法发送prompt HOT 3
- 1.8.3移除`CommandSession.args`导致类 Shell 参数解析Command出错 HOT 2
- 以 node-onebot 为后端无法正确设置 `ctx['to_me']` HOT 5
- 加載“失敗”的插件注冊的命令仍然可用 HOT 1
- 考慮移除 sched HOT 1
- NLPSession无法处理被两个qq表情夹着的关键词 HOT 11
- 运行`nb run`命令后直接抛出`cannot import name 'WebSocketSetup' from 'nonebot.drivers' ` HOT 1
- say 和 echo失踪 HOT 3
- NLPSession在较长的句子中不能识别到关键词 HOT 2
- 1
- 关于Pyinstaller打包后的exe为什么会报错的解决方案【建议调整一部分代码】
- 启动时遇到ImportError HOT 2
- m1 运行报错cannot import name 'escape' from 'jinja2' HOT 9
- ImportError: cannot import name 'overrides' from 'nonebot.typing' HOT 1
- 无法正确识别“回复”类型消息中的指令 HOT 2
- 按组一同注册命令的关键词 内容 权限 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nonebot.