chenbb0128 / moyu-chat Goto Github PK
View Code? Open in Web Editor NEWwechat,wechaty,typescript,cli,command
License: MIT License
wechat,wechaty,typescript,cli,command
License: MIT License
curl http://127.0.0.1:3000/0?alias=xxx'&'content=哈喽a
调用上面这个语句发送消息“哈喽”是乱码
对于一般的消息,终端能在1秒内输出接收到的消息。
但是被@时,约2到5秒终端才输出接收到的消息,比普通消息慢了许多。
测试了一下onMessage
函数并没有问题,问题应该是在发送消息到调用onMessage
函数的这个过程。
对比wechaty给出的6行demo,发现demo的WechatyBuilder.build
没有传入option,但是本项目传入了option
参数。
去掉option
参数后发现,被@的消息和普通消息的响应速度就一样了。
// 本项目
const bot = WechatyBuilder.build({
name: 'test-bot',
puppet: 'wechaty-puppet-wechat',
puppetOptions: {
uos: true,
},
})
// wechaty的demo
const wechaty = WechatyBuilder.build() // get a Wechaty instance
故猜测问题可能是指定了puppet
为wechaty-puppet-wechat
的原因,与wechaty-puppet-wechat
的实现有关。
去掉option
就能解决问题。
curl http://127.0.0.1:3000/sendContactMsg\?name\=Jixiangwuwxw'&'content\=测试消息
联系人消息成功
,但是服务报错ERR 发送联系人信息错误
sendMessage.ts
diff --git a/src/services/sendMessage.ts b/src/services/sendMessage.ts
index 95b3cc3..4e733fe 100644
--- a/src/services/sendMessage.ts
+++ b/src/services/sendMessage.ts
@@ -15,7 +15,7 @@ export async function sendContactMsg(bot: Wechaty, content: string, alias?: stri
contact.say(content)
}
catch (error) {
- log.error('发送联系人信息错误')
+ log.error('发送联系人信息错误', error)
}
}
ERR 发送联系人信息错误 Error: query must provide at least one key. current query is empty.
都有哪些接口呀?比如列出所有好友名称,删除好友,添加好友
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.