Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Can wxpy get context conversation? #22

Closed
demostars opened this issue Mar 28, 2017 · 3 comments
Closed

Can wxpy get context conversation? #22

demostars opened this issue Mar 28, 2017 · 3 comments

Comments

@demostars
Copy link

demostars commented Mar 28, 2017

您好~

wxpy可以获取响应上下消息么?

因为 一般的注册事件都是单句响应,图灵的上下文响应是通过特殊的uid实现的。

那么但就微信消息本身,能否做到呢?

比如

User - 用户
Bot - wxpy 程序

User: 下载xxx.mp4
下载完成是否上传? Bot
User:上传
上传完成,地址是:xxx Bot

如何实现这样的注册事件呢?现在的情况似乎无法实现,我尝试了一下。

再次感谢~

@youfou
Copy link
Owner

youfou commented Mar 28, 2017

可以通过 聊天对象的 .user_name 属性来辨别会话
wxpy.Tuling 内也是通过这种方式

@demostars
Copy link
Author

@youfou 嗯,我的解决办法是,自己定义一个外部变量用来暂存某个用户最近一条消息,然后做判断和更新。

感谢回复~

@youfou
Copy link
Owner

youfou commented Mar 29, 2017

也可以直接通过内置的 bot.messages 来查找

this_sender = msg.sender
sender_history = bot.messages.search(sender=this_sender)

@youfou youfou closed this as completed Mar 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants