Git Product home page Git Product logo

wechatrobot's Introduction

微信机器人

用于自动回复,定时发送,对接AI机器人等,运行在window平台下的可视化程序,主要是自用,项目写的较为简陋,因此,可能在使用时可能有一些莫名的异常,那么请告知我。

引用

模拟网页微信Http过程,参照了:https://github.com/sherlockchou86/WeChat.NET,在他的基础上略微修改了一下,独立成WXLogin项目

使用说明

直接运行:Bin\WxRobot.exe
查看插件效果:在PowerShell下运行Bin\WxRobot.exe plugin

界面主要有4个功能区域

  • 近期联系列表
  • 所有好友列表
  • 规则列表
  • 输出日记区

规则列表中有的是可以编辑的(按钮类型控件),单击即可出现编辑窗口。使用时,先选择一个规则然后设置好参数(如果该规则可以被编辑),再选择一个好友,点击最下面的start按钮即可将规则应用于该好友。

扩展自己的规则

无接口限制,按约定编码即可

常用的两个字段说明
userName:好友标识,可作为会话内唯一对好友的唯一标识符
nickName:好友名称,即好友实际显示的名称
msg:消息

扩展步骤:

  1. 新建一个程序集,建一个Rule,利用下表的数据接口编码,编译生成。
  2. 将生成的exe或者dll放到主程序目录下的plugin目录下,如果有引用,将引用的程序集也放到该目录下,注意程序集的命名空间和名称最好不要和已有的重名。

接口:

名称 类型 备注
RuleUser Dictionary<string, string> 静态只读字段,存储订阅该规则的用户信息, Key表示userName, value表示nickName
Name String 只读属性,表示在规则列表显示的名称
Me Tuple<string, string> 属性,item1表示nickNameitem2表示userName
SendMsg Action<string, string> 属性,用于发送消息,使用:SendMsg(arg1,arg2)arg1表示要发送用户的userNamearg2表示要发送的消息
Click void Click() 方法,当用户点击该规则时触发的操作
MsgHandle string MsgHandle(string userName, string msg, int type, int userType) 方法,当该用户发消息过来,调用该方法,type表示消息类型,请上网查阅具体含义
BingDing void BingDing(string userName, int userType) 方法,用户第一次应用该规则时触发
FromMe string FromMe(string userName, string msg, int type, int userType) 方法,当用户自己从其它设备上回复消息时,触发该方法

更新与问题

2017.08.04

  • 重构代码,使之稳定
  • 增加微信退出机制,增加获取全部讨论组和好友等

2017.08.06

  • 更细致的模拟微信,减少可能的异常
  • 格式化所有的消息,不会再有莫名其妙的文字,它处理消息的优先级要大于插件。它是通过IWXMsgHandle接口来实现的,提供一个默认实现:DefaultMsgHandle.dll,位于主程序目录下,若要自定义,直接替换它即可

wechatrobot's People

Contributors

jiang43605 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.