qqbot 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa9640a3b0d1829afb8e8a597d505583d918ca86
4
- data.tar.gz: 9f598d3abf7f85314c655c308cc94b89254206f4
3
+ metadata.gz: f4747aff11d6401325e92d7f6c971d5840161d84
4
+ data.tar.gz: 4887f1da58515e0482d1ada0dba7d384371f58c1
5
5
  SHA512:
6
- metadata.gz: 6256bf3d5c525b7d1f63aa98edf6c83ea5c46bb9417c74d287a428ff0ae88ab6a5a180748b08fcb8f57bac7e3dca77fff3acd16ca656f23579aa8d74d1b62740
7
- data.tar.gz: a0bc8fb618dcb78e375ca05f31cb6bdd221dca51a625eaf29d3eb39b88c3d2420037ebf1f1be68767eda25eec84d56aaca70b85bb947ebb95cca44a95a5a566a
6
+ metadata.gz: 685e6cbfb49018deb77299a4bd93dce9eeaceb69bd194fe111b2b485cda0a4b78621f8190611a87736951c4a38833a028e709d2fee2585c03787dd66cb663efa
7
+ data.tar.gz: b4464f68b8aeca510a989034257cbe8f59f16903340ed593c5771796331b557880d4a4c8b111e388d366dd8d67a20204d2d02a5bfc135056ad0861ebe8dca73d
data/.gitignore CHANGED
@@ -1,13 +1,15 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- lib/qqbot/qrcode.png
12
-
13
- qqbot-0.1.0.gem
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ lib/qqbot/qrcode.png
12
+
13
+ qqbot-0.1.0.gem
14
+
15
+ *.gem
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://ruby.taobao.org'
2
-
3
- # Specify your gem's dependencies in qqbot.gemspec
4
- gemspec
1
+ source 'https://ruby.taobao.org'
2
+
3
+ # Specify your gem's dependencies in qqbot.gemspec
4
+ gemspec
data/README.md CHANGED
@@ -1,40 +1,63 @@
1
- # QQBot
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/qqbot`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'qqbot'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install qqbot
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/ScienJus/qqbot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
37
-
38
- ## License
39
-
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
1
+ # QQBot
2
+
3
+ 基于 Smart QQ(Web QQ)的 QQ 机器人
4
+
5
+ ### 使用方法
6
+
7
+ 安装这个 Gem :
8
+
9
+ ```
10
+ gem install qqbot
11
+ ```
12
+
13
+ `require 'qqbot'`并编写自己的业务逻辑,例如:
14
+
15
+ ```
16
+ require 'qqbot'
17
+
18
+ qqbot = QQBot.new
19
+
20
+ qqbot.login
21
+
22
+ qqbot.get_group_list.each { |group| puts group.name }
23
+
24
+ qqbot.get_friend_list.each do |category|
25
+ puts category.name
26
+ category.friends.each do |friend|
27
+ puts "———— #{friend.nickname}"
28
+ end
29
+ end
30
+ ```
31
+
32
+ ### Api 列表
33
+
34
+ - [x] 登录
35
+ - [x] 拉取消息
36
+ - [x] 获取群列表
37
+ - [x] 获取好友列表
38
+ - [x] 获取讨论组列表
39
+ - [ ] 发送私聊消息
40
+ - [ ] 发送群消息
41
+ - [ ] 发送临时消息
42
+ - [ ] 好友详细信息
43
+ - [ ] 群详细信息
44
+ - [ ] 讨论组详细信息
45
+ - [ ] 获取在线好友
46
+ - [ ] 获取最近会话
47
+ - [ ] 获取登录用户信息
48
+ - [ ] 查询用户 QQ 号
49
+ - [ ] 退出登录
50
+
51
+
52
+ ### 拓展功能列表
53
+
54
+ - [x] 登录时保存二维码到本地
55
+ - [x] 登录时通过网页查看二维码
56
+ - [ ] 登录时发送二维码到指定邮箱
57
+ - [ ] 登录时将二维码打印到控制台
58
+ - [ ] 登录失效后邮件推送信息
59
+
60
+
61
+ ### 反馈
62
+
63
+ 有问题或是建议可以提 Issues ,或是发邮件联系我,我的邮箱:`i@scienjus.com`
@@ -1,17 +1,23 @@
1
- require 'qqbot/version'
2
- require 'logger'
3
-
4
- module QQBot
5
-
6
- LOGGER = Logger.new(STDOUT)
7
-
8
- autoload :Auth, 'qqbot/auth'
9
- autoload :Cookie, 'qqbot/cookie'
10
- autoload :Client, 'qqbot/client'
11
- autoload :Api, 'qqbot/api'
12
- autoload :Bot, 'qqbot/bot'
13
-
14
- def self.new
15
- QQBot::Bot.new
16
- end
17
- end
1
+ require 'qqbot/version'
2
+ require 'logger'
3
+
4
+ module QQBot
5
+
6
+ LOGGER = Logger.new(STDOUT)
7
+
8
+ autoload :Auth, 'qqbot/auth'
9
+ autoload :Cookie, 'qqbot/cookie'
10
+ autoload :Client, 'qqbot/client'
11
+ autoload :Api, 'qqbot/api'
12
+ autoload :Bot, 'qqbot/bot'
13
+ autoload :Group, 'qqbot/model'
14
+ autoload :Friend, 'qqbot/model'
15
+ autoload :Category, 'qqbot/model'
16
+ autoload :Discuss, 'qqbot/model'
17
+ autoload :Message, 'qqbot/model'
18
+ autoload :Font, 'qqbot/model'
19
+
20
+ def self.new
21
+ QQBot::Bot.new
22
+ end
23
+ end
@@ -1,42 +1,149 @@
1
- require 'uri'
2
- require 'json'
3
- require "fileutils"
4
-
5
- module QQBot
6
- class Api
7
-
8
- def initialize(client, options = {})
9
- @client = client
10
- @options = options
11
- end
12
-
13
- def poll
14
- uri = URI('http://d1.web2.qq.com/channel/poll2')
15
-
16
- r = JSON.generate(
17
- ptwebqq: @options[:ptwebqq],
18
- clientid: 53999199,
19
- psessionid: @options[:psessionid],
20
- key: ''
21
- )
22
-
23
- begin
24
- code, body = @client.post(uri, 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2', r: r)
25
- rescue [ExceptionType = Net::ReadTimeout]
26
- return
27
- end
28
-
29
- if code == '200'
30
- json = JSON.parse body
31
- if json['retcode'] == 0
32
- return json['result']
33
- else
34
- QQBot::LOGGER.info "获取消息失败 返回码 #{json['retcode']}"
35
- end
36
- else
37
- QQBot::LOGGER.info "请求失败,返回码#{code}"
38
- end
39
-
40
- end
41
- end
42
- end
1
+ require 'uri'
2
+ require 'json'
3
+ require 'fileutils'
4
+
5
+ module QQBot
6
+ class Api
7
+
8
+ def initialize(client, options = {})
9
+ @client = client
10
+ @options = options
11
+ end
12
+
13
+ def self.hash(uin, ptwebqq)
14
+ n = Array.new(4, 0)
15
+
16
+ for i in (0...ptwebqq.size)
17
+ n[i % 4] ^= ptwebqq[i].ord
18
+ end
19
+
20
+ u = ['EC', 'OK']
21
+
22
+ v = Array.new(4)
23
+ v[0] = uin >> 24 & 255 ^ u[0][0].ord;
24
+ v[1] = uin >> 16 & 255 ^ u[0][1].ord;
25
+ v[2] = uin >> 8 & 255 ^ u[1][0].ord;
26
+ v[3] = uin & 255 ^ u[1][1].ord;
27
+
28
+ u = Array.new(8)
29
+ for i in (0...8)
30
+ u[i] = i.odd? ? v[i >> 1] : n[i >> 1]
31
+ end
32
+
33
+ n = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
34
+
35
+ v = ''
36
+
37
+ u.each do |i|
38
+ v << n[(i >> 4) & 15]
39
+ v << n[i & 15]
40
+ end
41
+
42
+ v
43
+ end
44
+
45
+ def poll
46
+ uri = URI('http://d1.web2.qq.com/channel/poll2')
47
+
48
+ r = JSON.generate(
49
+ ptwebqq: @options[:ptwebqq],
50
+ clientid: 53999199,
51
+ psessionid: @options[:psessionid],
52
+ key: ''
53
+ )
54
+
55
+ begin
56
+ code, body = @client.post(uri, 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2', r: r)
57
+ rescue
58
+ retry
59
+ end
60
+
61
+ if code == '200'
62
+ json = JSON.parse body
63
+ if json['retcode'] == 0
64
+ return json['result']
65
+ else
66
+ QQBot::LOGGER.info "获取消息失败 返回码 #{json['retcode']}"
67
+ end
68
+ else
69
+ QQBot::LOGGER.info "请求失败,返回码#{code}"
70
+ end
71
+ end
72
+
73
+ def get_group_list
74
+ uri = URI('http://s.web2.qq.com/api/get_group_name_list_mask2')
75
+
76
+ r = JSON.generate(
77
+ vfwebqq: @options[:vfwebqq],
78
+ hash: hash
79
+ )
80
+
81
+ code, body = @client.post(uri, 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2', r: r)
82
+
83
+ if code == '200'
84
+ json = JSON.parse body
85
+ if json['retcode'] == 0
86
+ return json['result']
87
+ else
88
+ QQBot::LOGGER.info "获取群列表失败 返回码 #{json['retcode']}"
89
+ end
90
+ else
91
+ QQBot::LOGGER.info "请求失败,返回码#{code}"
92
+ end
93
+ end
94
+
95
+ def hash
96
+ self.class.hash(@options[:uin], @options[:ptwebqq])
97
+ end
98
+
99
+ def get_friend_list
100
+ uri = URI('http://s.web2.qq.com/api/get_user_friends2')
101
+
102
+ r = JSON.generate(
103
+ vfwebqq: @options[:vfwebqq],
104
+ hash: hash
105
+ )
106
+
107
+ code, body = @client.post(uri, 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1', r: r)
108
+
109
+ if code == '200'
110
+ json = JSON.parse body
111
+ if json['retcode'] == 0
112
+ return json['result']
113
+ else
114
+ QQBot::LOGGER.info "获取好友列表失败 返回码 #{json['retcode']}"
115
+ end
116
+ else
117
+ QQBot::LOGGER.info "请求失败,返回码#{code}"
118
+ end
119
+ end
120
+
121
+ def get_discuss_list
122
+ uri = URI('http://s.web2.qq.com/api/get_discus_list')
123
+ uri.query =
124
+ URI.encode_www_form(
125
+ clientid: 53999199,
126
+ psessionid: @options[:psessionid],
127
+ vfwebqq: @options[:vfwebqq],
128
+ t: 0.1
129
+ )
130
+
131
+ code, body = @client.get(uri, 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2')
132
+
133
+ if code == '200'
134
+ json = JSON.parse body
135
+ if json['retcode'] == 0
136
+ return json['result']
137
+ else
138
+ QQBot::LOGGER.info "获取群列表失败 返回码 #{json['retcode']}"
139
+ end
140
+ else
141
+ QQBot::LOGGER.info "请求失败,返回码#{code}"
142
+ end
143
+ end
144
+
145
+ def hash
146
+ self.class.hash(@options[:uin], @options[:ptwebqq])
147
+ end
148
+ end
149
+ end
@@ -1,180 +1,180 @@
1
- require 'uri'
2
- require 'json'
3
- require "fileutils"
4
-
5
- module QQBot
6
- class Auth
7
-
8
- def initialize client
9
- @client = client
10
- end
11
-
12
- def get_qrcode
13
- QQBot::LOGGER.info '开始获取二维码'
14
-
15
- uri = URI('https://ssl.ptlogin2.qq.com/ptqrshow');
16
-
17
- uri.query =
18
- URI.encode_www_form(
19
- appid: 501004106,
20
- e: 0,
21
- l: :M,
22
- s: 5,
23
- d: 72,
24
- v: 4,
25
- t: 0.1,
26
- )
27
-
28
- code, body = @client.get uri
29
-
30
- if code == '200'
31
- file_name = File.expand_path('qrcode.png', File.dirname(__FILE__));
32
-
33
- File.open(file_name, 'wb') do |file|
34
- file.write body
35
- file.close
36
- end
37
-
38
- QQBot::LOGGER.info "二维码已经保存在#{file_name}中"
39
-
40
- if @pid == nil
41
- QQBot::LOGGER.info '开启web服务进程'
42
-
43
- @pid = spawn("ruby -run -e httpd #{file_name} -p 9090", out: '/dev/null')
44
- end
45
-
46
- QQBot::LOGGER.info '也可以通过访问 http://localhost:9090 查看二维码'
47
- else
48
- QQBot::LOGGER.info "请求失败,返回码#{code}"
49
- end
50
- end
51
-
52
- def verify_qrcode
53
- QQBot::LOGGER.info '等待扫描二维码'
54
-
55
- uri = URI('https://ssl.ptlogin2.qq.com/ptqrlogin');
56
- uri.query =
57
- URI.encode_www_form(
58
- webqq_type: 10,
59
- remember_uin: 1,
60
- login2qq: 1,
61
- aid: 501004106,
62
- u1: 'http://Fw.qq.com/proxy.html?login2qq=1&webqq_type=10',
63
- ptredirect: 0,
64
- ptlang: 2052,
65
- daid: 164,
66
- from_ui: 1,
67
- pttype: 1,
68
- dumy: '',
69
- fp: 'loginerroralert',
70
- action: '0-0-157510',
71
- mibao_css: 'm_webqq',
72
- t: 1,
73
- g: 1,
74
- js_type: 0,
75
- js_ver: 10143,
76
- login_sig: '',
77
- pt_randsalt: 0,
78
- )
79
-
80
- code, body = @client.get uri
81
-
82
- if code == '200'
83
- result = body.force_encoding("UTF-8")
84
- if result.include? '二维码已失效'
85
- QQBot::LOGGER.info '二维码已失效,请重新获取'
86
- return '-1'
87
- elsif result.include? 'http'
88
- QQBot::LOGGER.info '认证成功'
89
- unless @pid == nil
90
- QQBot::LOGGER.info '关闭web服务进程'
91
- system "kill -9 #{@pid}"
92
- end
93
- return URI.extract(result)[0]
94
- else
95
- return '0'
96
- end
97
- else
98
- QQBot::LOGGER.info "请求失败,返回码#{code}"
99
- return '0'
100
- end
101
- end
102
-
103
- def get_ptwebqq url
104
- QQBot::LOGGER.info '开始获取ptwebqq'
105
-
106
- uri = URI(url);
107
-
108
- code, body = @client.get(uri, 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1')
109
-
110
- if code == '302'
111
- @ptwebqq = @client.get_cookie :ptwebqq
112
- else
113
- QQBot::LOGGER.info "请求失败,返回码#{code}"
114
- end
115
- end
116
-
117
- def get_vfwebqq
118
- QQBot::LOGGER.info '开始获取vfwebqq'
119
-
120
- uri = URI('http://s.web2.qq.com/api/getvfwebqq');
121
-
122
- uri.query =
123
- URI.encode_www_form(
124
- ptwebqq: @ptwebqq,
125
- clientid: 53999199,
126
- psessionid: '',
127
- t: 0.1,
128
- )
129
-
130
- code, body = @client.get(uri, 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1')
131
-
132
- if code == '200'
133
- json = JSON.parse body
134
- if json['retcode'] == 0
135
- @vfwebqq = json['result']['vfwebqq']
136
- else
137
- QQBot::LOGGER.info "获取vfwebqq失败 返回码 #{json['retcode']}"
138
- end
139
- else
140
- QQBot::LOGGER.info "请求失败,返回码#{code}"
141
- end
142
- end
143
-
144
- def get_psessionid_and_uin
145
- QQBot::LOGGER.info '开始获取psessionid和uin'
146
-
147
- uri = URI('http://d1.web2.qq.com/channel/login2');
148
-
149
- r = JSON.generate(
150
- ptwebqq: @ptwebqq,
151
- clientid: 53999199,
152
- psessionid: '',
153
- status: 'online'
154
- )
155
-
156
- code, body = @client.post(uri, 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2', r: r)
157
-
158
- if code == '200'
159
- json = JSON.parse body
160
- if json['retcode'] == 0
161
- @uin = json['result']['uin']
162
- @psessionid = json['result']['psessionid']
163
- else
164
- QQBot::LOGGER.info "获取vfwebqq失败 返回码 #{json['retcode']}"
165
- end
166
- else
167
- QQBot::LOGGER.info "请求失败,返回码#{code}"
168
- end
169
- end
170
-
171
- def options
172
- {
173
- ptwebqq: @ptwebqq,
174
- vfwebqq: @vfwebqq,
175
- psessionid: @psessionid,
176
- uin: @uin
177
- }
178
- end
179
- end
180
- end
1
+ require 'uri'
2
+ require 'json'
3
+ require 'fileutils'
4
+
5
+ module QQBot
6
+ class Auth
7
+
8
+ def initialize client
9
+ @client = client
10
+ end
11
+
12
+ def get_qrcode
13
+ QQBot::LOGGER.info '开始获取二维码'
14
+
15
+ uri = URI('https://ssl.ptlogin2.qq.com/ptqrshow');
16
+
17
+ uri.query =
18
+ URI.encode_www_form(
19
+ appid: 501004106,
20
+ e: 0,
21
+ l: :M,
22
+ s: 5,
23
+ d: 72,
24
+ v: 4,
25
+ t: 0.1,
26
+ )
27
+
28
+ code, body = @client.get uri
29
+
30
+ if code == '200'
31
+ file_name = File.expand_path('qrcode.png', File.dirname(__FILE__));
32
+
33
+ File.open(file_name, 'wb') do |file|
34
+ file.write body
35
+ file.close
36
+ end
37
+
38
+ QQBot::LOGGER.info "二维码已经保存在#{file_name}中"
39
+
40
+ if @pid.nil?
41
+ QQBot::LOGGER.info '开启web服务进程'
42
+ @pid = spawn("ruby -run -e httpd #{file_name} -p 9090")
43
+ end
44
+
45
+ QQBot::LOGGER.info '也可以通过访问 http://localhost:9090 查看二维码'
46
+ else
47
+ QQBot::LOGGER.info "请求失败,返回码#{code}"
48
+ end
49
+ end
50
+
51
+ def verify_qrcode
52
+ QQBot::LOGGER.info '等待扫描二维码'
53
+
54
+ uri = URI('https://ssl.ptlogin2.qq.com/ptqrlogin');
55
+ uri.query =
56
+ URI.encode_www_form(
57
+ webqq_type: 10,
58
+ remember_uin: 1,
59
+ login2qq: 1,
60
+ aid: 501004106,
61
+ u1: 'http://Fw.qq.com/proxy.html?login2qq=1&webqq_type=10',
62
+ ptredirect: 0,
63
+ ptlang: 2052,
64
+ daid: 164,
65
+ from_ui: 1,
66
+ pttype: 1,
67
+ dumy: '',
68
+ fp: 'loginerroralert',
69
+ action: '0-0-157510',
70
+ mibao_css: 'm_webqq',
71
+ t: 1,
72
+ g: 1,
73
+ js_type: 0,
74
+ js_ver: 10143,
75
+ login_sig: '',
76
+ pt_randsalt: 0,
77
+ )
78
+
79
+ code, body = @client.get uri
80
+
81
+ if code == '200'
82
+ result = body.force_encoding("UTF-8")
83
+ if result.include? '二维码已失效'
84
+ QQBot::LOGGER.info '二维码已失效,请重新获取'
85
+ return '-1'
86
+ elsif result.include? 'http'
87
+ QQBot::LOGGER.info '认证成功'
88
+ unless @pid.nil?
89
+ QQBot::LOGGER.info '关闭web服务进程'
90
+ Process.kill('KILL', @pid)
91
+ @pid = nil
92
+ end
93
+ return URI.extract(result)[0]
94
+ else
95
+ return '0'
96
+ end
97
+ else
98
+ QQBot::LOGGER.info "请求失败,返回码#{code}"
99
+ return '0'
100
+ end
101
+ end
102
+
103
+ def get_ptwebqq url
104
+ QQBot::LOGGER.info '开始获取ptwebqq'
105
+
106
+ uri = URI(url);
107
+
108
+ code, body = @client.get(uri, 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1')
109
+
110
+ if code == '302'
111
+ @ptwebqq = @client.get_cookie 'ptwebqq'
112
+ else
113
+ QQBot::LOGGER.info "请求失败,返回码#{code}"
114
+ end
115
+ end
116
+
117
+ def get_vfwebqq
118
+ QQBot::LOGGER.info '开始获取vfwebqq'
119
+
120
+ uri = URI('http://s.web2.qq.com/api/getvfwebqq');
121
+
122
+ uri.query =
123
+ URI.encode_www_form(
124
+ ptwebqq: @ptwebqq,
125
+ clientid: 53999199,
126
+ psessionid: '',
127
+ t: 0.1,
128
+ )
129
+
130
+ code, body = @client.get(uri, 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1')
131
+
132
+ if code == '200'
133
+ json = JSON.parse body
134
+ if json['retcode'] == 0
135
+ @vfwebqq = json['result']['vfwebqq']
136
+ else
137
+ QQBot::LOGGER.info "获取vfwebqq失败 返回码 #{json['retcode']}"
138
+ end
139
+ else
140
+ QQBot::LOGGER.info "请求失败,返回码#{code}"
141
+ end
142
+ end
143
+
144
+ def get_psessionid_and_uin
145
+ QQBot::LOGGER.info '开始获取psessionid和uin'
146
+
147
+ uri = URI('http://d1.web2.qq.com/channel/login2');
148
+
149
+ r = JSON.generate(
150
+ ptwebqq: @ptwebqq,
151
+ clientid: 53999199,
152
+ psessionid: '',
153
+ status: 'online'
154
+ )
155
+
156
+ code, body = @client.post(uri, 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2', r: r)
157
+
158
+ if code == '200'
159
+ json = JSON.parse body
160
+ if json['retcode'] == 0
161
+ @uin = json['result']['uin']
162
+ @psessionid = json['result']['psessionid']
163
+ else
164
+ QQBot::LOGGER.info "获取vfwebqq失败 返回码 #{json['retcode']}"
165
+ end
166
+ else
167
+ QQBot::LOGGER.info "请求失败,返回码#{code}"
168
+ end
169
+ end
170
+
171
+ def options
172
+ {
173
+ ptwebqq: @ptwebqq,
174
+ vfwebqq: @vfwebqq,
175
+ psessionid: @psessionid,
176
+ uin: @uin
177
+ }
178
+ end
179
+ end
180
+ end