微信机器人 Ruby 版本。
require 'wechat-bot'
bot = WeChat::Bot.new do
on :message, "ping" do |message|
message.reply "PONG"
end
end
bot.start
还不知道如何走向的微信机器人
License: MIT License
添加好友的消息验证支持:
{
"BaseResponse": {
"Ret": 0,
"ErrMsg": ""
},
"AddMsgCount": 1,
"AddMsgList": [
{
"MsgId": "2072363471476057614",
"FromUserName": "fmessage",
"ToUserName": "@cccccccccccccccc",
"MsgType": 37,
"Content": "<msg fromusername=\"icyleaf\" encryptusername=\"aaaaaaaaa@stranger\" fromnickname=\"icyleaf<span class=\"emoji emoji1f37a\"></span>\" content=\"我是icyleaf\" shortpy=\"ICYLEAF?\" imagestatus=\"3\" scene=\"3\" country=\"NL\" province=\"Rotterdam\" city=\"\" sign=\"爱好户外的代码仔,下厨初心者\" percard=\"1\" sex=\"1\" alias=\"\" weibo=\"\" weibonickname=\"\" albumflag=\"0\" albumstyle=\"0\" albumbgimgid=\"916984107630592_916984107630592\" snsflag=\"49\" snsbgimgid=\"http://mmsns.qpic.cn/mmsns/pbuUcBancwpmPuCsleNS6mqkicTJ4Z50HYANOp5SwUdHLU0g/0\" snsbgobjectid=\"11932405796503722\" mhash=\"ce0d1651a79363d221fd668d359a\" mfullhash=\"ce0d1651a79363d22fd668d359a\" bigheadimgurl=\"http://wx.qlogo.cn/mmhead/ver_1/cF4rribxYH1bmLvoHVwweibgwnENFjcDjQcnuKQxuyQMzfxZZuHvpfA5icpGicguLnBIkyBiagtiboNREOFz82Q/0\" smallheadimgurl=\"http://wx.qlogo.cn/mmhead/ver_1/cF4rribxYeHLvoHVwweibgwnENFjcDjQcnuKQxuyQMzfxZZuHvpfA5icpGicguLnBIkyBiagtiboNREOFz82Q/132\" ticket=\"v2_8bbdcbb874412bff7a689586ab7595e025cb6721216ce80a321ef0f5badb739bac81793079d39e20104b2ed31944@stranger\" opcode=\"2\" googlecontact=\"\" qrticket=\"\" chatroomusername=\"\" sourceusername=\"\" sourcenickname=\"\"><brandlist count=\"0\" ver=\"658641770\"></brandlist></msg>",
"Status": 3,
"ImgStatus": 1,
"CreateTime": 1498458422,
"VoiceLength": 0,
"PlayLength": 0,
"FileName": "",
"FileSize": "",
"MediaId": "",
"Url": "",
"AppMsgType": 0,
"StatusNotifyCode": 0,
"StatusNotifyUserName": "",
"RecommendInfo": {
"UserName": "@aaaaaaaaaaaaaaaa",
"NickName": "icyleaf<span class=\"emoji emoji1f37a\"></span>",
"QQNum": 0,
"Province": "Rotterdam",
"City": "",
"Content": "我是icyleaf",
"Signature": "爱好户外的代码仔,下厨初心者",
"Alias": "",
"Scene": 3,
"VerifyFlag": 0,
"AttrStatus": 37986749,
"Sex": 1,
"Ticket": "v2_8bbdcbb874412bfb6721216ce80a321ef0f5badb739bac81793079d39e20104b2ed31944@stranger",
"OpCode": 2
},
"ForwardFlag": 0,
"AppInfo": {
"AppID": "",
"Type": 0
},
"HasProductId": 0,
"Ticket": "",
"ImgHeight": 0,
"ImgWidth": 0,
"SubMsgType": 0,
"NewMsgId": 2072363471476057600,
"OriContent": ""
}
],
"ModContactCount": 0,
"ModContactList": [],
"DelContactCount": 0,
"DelContactList": [],
"ModChatRoomMemberCount": 0,
"ModChatRoomMemberList": [],
"Profile": {
"BitFlag": 0,
"UserName": {
"Buff": ""
},
"NickName": {
"Buff": ""
},
"BindUin": 0,
"BindEmail": {
"Buff": ""
},
"BindMobile": {
"Buff": ""
},
"Status": 0,
"Sex": 0,
"PersonalCard": 0,
"Alias": "",
"HeadImgUpdateFlag": 0,
"HeadImgUrl": "",
"Signature": ""
},
"ContinueFlag": 0,
"SyncKey": {
"Count": 8,
"List": [
{
"Key": 1,
"Val": 111
},
{
"Key": 2,
"Val": 22
},
{
"Key": 3,
"Val": 33
},
{
"Key": 11,
"Val": 444
}
]
},
"SKey": "",
"SyncCheckKey": {
"Count": 8,
"List": [
{
"Key": 1,
"Val": 1111
},
{
"Key": 2,
"Val": 222
},
{
"Key": 3,
"Val": 333
},
{
"Key": 11,
"Val": 444
}
]
}
}
wechat-bot-0.1.3/lib/wechat/bot/message.rb:97:in `parse': uninitialized constant WeChat::Bot::Message::CGI (NameError)
message = CGI.unescape_html(message) if @kinde != Message::Kind::Text
R.T.
/Users/jevan/.rvm/gems/ruby-2.4.1/gems/wechat-bot-0.1.0.alpha/lib/wechat/bot/ext/wechat_emoji_string.rb:1:in `<top (required)>': uninitialized constant WeChat (NameError)
from /Users/jevan/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/jevan/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/jevan/.rvm/gems/ruby-2.4.1/gems/wechat-bot-0.1.0.alpha/lib/wechat/bot.rb:1:in `<top (required)>'
from /Users/jevan/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/jevan/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/jevan/.rvm/gems/ruby-2.4.1/gems/wechat-bot-0.1.0.alpha/lib/wechat-bot.rb:1:in `<top (required)>'
from /Users/jevan/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from /Users/jevan/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from /Users/jevan/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
看文件结构 最顶部的module应该为Wechat?
jslogin
获取 uuidl/uuid
获取 QR Codelogin
验证登录webwxinit
初始化webwxstatusnotify
设置状态通知webwxlogout
登出synccheck
消息状态webwxsync
消息详情webwxsendmsg
文本消息webwxsendmsgimg
图片消息webwxsendemoticon
自定义表情消息(不支持微信商店表情)webwxrevokemsg
撤回消息webwxgetcontact
联系人列表webwxbatchgetcontact
批量获取联系人列表webwxverifyuser
添加好友webwxuploadmedia
上传图片webwxgetmsgimg
获取具体图片webwxcreatechatroom
创建群组webwxupdatechatroom
更新群组(修改群组名、添加/删除成员)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.