id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
xhan/qqbot:src/qqapi.coffee:7:raw_corpus | raw_corpus | exports.send_msg_2group = (gid, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: gid
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font", {na... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 918e7deefb56a60b0aaee2e4c067115501e7a2d5 | 1,435 | https://github.com/xhan/qqbot/blob/918e7deefb56a60b0aaee2e4c067115501e7a2d5/src/qqapi.coffee | 137 | 152 | ||
xhan/qqbot:src/qqapi.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.send_msg_2group = (gid, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: gid
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.ps... | exports.send_msg_2group = function(gid, msg, auth_opts, callback) {
var opt, params, r, url;
url = 'http://d.web2.qq.com/channel/send_qun_msg2';
opt = auth_opts;
r = {
group_uin: gid,
msg_id: 1000001, //随机msgid
clientid: `${opt.clientid}`,
psessionid: opt.psessionid,
content: jsons([
`... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 918e7deefb56a60b0aaee2e4c067115501e7a2d5 | 1,435 | https://github.com/xhan/qqbot/blob/918e7deefb56a60b0aaee2e4c067115501e7a2d5/src/qqapi.coffee | 137 | 152 |
xhan/qqbot:src/qqapi.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.send_msg_2group = function(gid, msg, auth_opts, callback) {
var opt, params, r, url;
url = 'http://d.web2.qq.com/channel/send_qun_msg2';
opt = auth_opts;
r = {
group_uin: gid,
msg_id: 1000001, //随机msgid
clientid: `${opt.clientid}`,
p... | exports.send_msg_2group = (gid, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: gid
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font", {na... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 918e7deefb56a60b0aaee2e4c067115501e7a2d5 | 1,435 | https://github.com/xhan/qqbot/blob/918e7deefb56a60b0aaee2e4c067115501e7a2d5/src/qqapi.coffee | 137 | 152 |
xhan/qqbot:src/qqapi.coffee:7:completion | completion | exports.send_msg_2group = (gid, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: gid
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid | content: jsons ["#{msg}" , ["font", {name:"宋体", size:"10", style:[0,0,0], color:"000000" }] ]
params =
r: jsons r
clientid: opt.clientid
psessionid:opt.psessionid
client.post {url:url} , params , (ret,e)->
log.debug 'send2group',jsons ret
callback(ret,e) | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 918e7deefb56a60b0aaee2e4c067115501e7a2d5 | 1,435 | https://github.com/xhan/qqbot/blob/918e7deefb56a60b0aaee2e4c067115501e7a2d5/src/qqapi.coffee | 137 | 152 |
xhan/qqbot:src/qqapi.coffee:2:raw_corpus | raw_corpus | long_poll = (auth_opts, callback) ->
log "polling..."
[clientid, psessionid] = [auth_opts.clientid, auth_opts.psessionid]
url = "http://d.web2.qq.com/channel/poll2"
r =
clientid: "#{clientid}"
psessionid: psessionid
key:0
ids:[]
params =
clientid: clientid
... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 28 | 74 | ||
xhan/qqbot:src/qqapi.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
long_poll = (auth_opts, callback) ->
log "polling..."
[clientid, psessionid] = [auth_opts.clientid, auth_opts.psessionid]
url = "http://d.web2.qq.com/channel/poll2"
r =
clientid: "#{clientid}"
psessionid: psessionid
key:0
... | var hash_func, long_poll;
long_poll = function(auth_opts, callback) {
var clientid, params, psessionid, r, url;
log("polling...");
[clientid, psessionid] = [auth_opts.clientid, auth_opts.psessionid];
url = "http://d.web2.qq.com/channel/poll2";
r = {
clientid: `${clientid}`,
psessionid: psessionid,
... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 28 | 74 |
xhan/qqbot:src/qqapi.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var hash_func, long_poll;
long_poll = function(auth_opts, callback) {
var clientid, params, psessionid, r, url;
log("polling...");
[clientid, psessionid] = [auth_opts.clientid, auth_opts.psessionid];
url = "http://d.web2.qq.com/channel/poll2";
r = {
... | long_poll = (auth_opts, callback) ->
log "polling..."
[clientid, psessionid] = [auth_opts.clientid, auth_opts.psessionid]
url = "http://d.web2.qq.com/channel/poll2"
r =
clientid: "#{clientid}"
psessionid: psessionid
key:0
ids:[]
params =
clientid: clientid
... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 28 | 74 |
xhan/qqbot:src/qqapi.coffee:2:completion | completion | long_poll = (auth_opts, callback) ->
log "polling..."
[clientid, psessionid] = [auth_opts.clientid, auth_opts.psessionid]
url = "http://d.web2.qq.com/channel/poll2"
r =
clientid: "#{clientid}"
psessionid: psessionid
key:0
ids:[]
params =
clientid: clientid
... | `
function(b, i) {
for (var a = [], s = 0; s < i.length; s++) a[s % 4] ^= i.charCodeAt(s);
var j = ["EC", "OK"],
d = [];
d[0] = b >> 24 & 255 ^ j[0].charCodeAt(0);
d[1] = b >> 16 & 255 ^ j[0].charCodeAt(1);
d[2] = b >> 8... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 28 | 74 |
xhan/qqbot:src/qqapi.coffee:6:raw_corpus | raw_corpus | exports.send_msg_2buddy = (to_uin , msg , auth_opts ,callback)->
url = "http://d.web2.qq.com/channel/send_buddy_msg2"
opt = auth_opts
r =
to: to_uin
face: 0
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font",... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 114 | 138 | ||
xhan/qqbot:src/qqapi.coffee:6:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.send_msg_2buddy = (to_uin , msg , auth_opts ,callback)->
url = "http://d.web2.qq.com/channel/send_buddy_msg2"
opt = auth_opts
r =
to: to_uin
face: 0
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid:... | exports.send_msg_2buddy = function(to_uin, msg, auth_opts, callback) {
var opt, params, r, url;
url = "http://d.web2.qq.com/channel/send_buddy_msg2";
opt = auth_opts;
r = {
to: to_uin,
face: 0,
msg_id: 1000001, //随机msgid
clientid: `${opt.clientid}`,
psessionid: opt.psessionid,
content: j... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 114 | 138 |
xhan/qqbot:src/qqapi.coffee:6:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.send_msg_2buddy = function(to_uin, msg, auth_opts, callback) {
var opt, params, r, url;
url = "http://d.web2.qq.com/channel/send_buddy_msg2";
opt = auth_opts;
r = {
to: to_uin,
face: 0,
msg_id: 1000001, //随机msgid
clientid: `${opt.cli... | exports.send_msg_2buddy = (to_uin , msg , auth_opts ,callback)->
url = "http://d.web2.qq.com/channel/send_buddy_msg2"
opt = auth_opts
r =
to: to_uin
face: 0
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font",... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 114 | 138 |
xhan/qqbot:src/qqapi.coffee:6:completion | completion | exports.send_msg_2buddy = (to_uin , msg , auth_opts ,callback)->
url = "http://d.web2.qq.com/channel/send_buddy_msg2"
opt = auth_opts
r =
to: to_uin
face: 0
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font",... | r: jsons r
clientid: opt.clientid
psessionid: opt.psessionid
# log params
client.post {url:url} , params , (ret,e) ->
callback( ret , e )
# @param gid: gid
# @param msg, 消息
# @param auth_opts: [clientid,psessionid]
# @param callback: ret, e
# @return ret retcode 0 | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 114 | 138 |
xhan/qqbot:src/qqapi.coffee:7:raw_corpus | raw_corpus | exports.send_msg_2group = (gid, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: gid
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font", {na... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 139 | 153 | ||
xhan/qqbot:src/qqapi.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.send_msg_2group = (gid, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: gid
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.ps... | exports.send_msg_2group = function(gid, msg, auth_opts, callback) {
var opt, params, r, url;
url = 'http://d.web2.qq.com/channel/send_qun_msg2';
opt = auth_opts;
r = {
group_uin: gid,
msg_id: 1000001, //随机msgid
clientid: `${opt.clientid}`,
psessionid: opt.psessionid,
content: jsons([
`... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 139 | 153 |
xhan/qqbot:src/qqapi.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.send_msg_2group = function(gid, msg, auth_opts, callback) {
var opt, params, r, url;
url = 'http://d.web2.qq.com/channel/send_qun_msg2';
opt = auth_opts;
r = {
group_uin: gid,
msg_id: 1000001, //随机msgid
clientid: `${opt.clientid}`,
p... | exports.send_msg_2group = (gid, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: gid
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font", {na... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 139 | 153 |
xhan/qqbot:src/qqapi.coffee:7:completion | completion | exports.send_msg_2group = (gid, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: gid
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}" | psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font", {name:"宋体", size:"10", style:[0,0,0], color:"000000" }] ]
params =
r: jsons r
clientid: opt.clientid
psessionid:opt.psessionid
client.post {url:url} , params , (ret,e)->
callback(ret,e) | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | afe90196dc347cf9421e07b69e4d10c8e69011c6 | 1,435 | https://github.com/xhan/qqbot/blob/afe90196dc347cf9421e07b69e4d10c8e69011c6/src/qqapi.coffee | 139 | 153 |
xhan/qqbot:src/qqapi.coffee:1:raw_corpus | raw_corpus | md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 12 | 17 | ||
xhan/qqbot:src/qqapi.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
``` | var log, md5;
md5 = function(str) {
var md5sum;
md5sum = crypto.createHash('md5');
return md5sum.update(str).digest('hex');
};
// TODO: logger 分级控制
log = console.log; | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 12 | 17 |
xhan/qqbot:src/qqapi.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var log, md5;
md5 = function(str) {
var md5sum;
md5sum = crypto.createHash('md5');
return md5sum.update(str).digest('hex');
};
// TODO: logger 分级控制
log = console.log;
``` | md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 12 | 17 |
xhan/qqbot:src/qqapi.coffee:1:completion | completion | md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex') | # TODO: logger 分级控制
log = console.log | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 12 | 17 |
xhan/qqbot:src/qqapi.coffee:2:raw_corpus | raw_corpus | exports.cookies = (cookie)->
if cookie
all_cookies = cookie
client.global_cookies(all_cookies)
return all_cookies | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 19 | 23 | ||
xhan/qqbot:src/qqapi.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.cookies = (cookie)->
if cookie
all_cookies = cookie
client.global_cookies(all_cookies)
return all_cookies
``` | exports.cookies = function(cookie) {
var all_cookies;
if (cookie) {
all_cookies = cookie;
client.global_cookies(all_cookies);
}
return all_cookies;
}; | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 19 | 23 |
xhan/qqbot:src/qqapi.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.cookies = function(cookie) {
var all_cookies;
if (cookie) {
all_cookies = cookie;
client.global_cookies(all_cookies);
}
return all_cookies;
};
``` | exports.cookies = (cookie)->
if cookie
all_cookies = cookie
client.global_cookies(all_cookies)
return all_cookies | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 19 | 23 |
xhan/qqbot:src/qqapi.coffee:2:completion | completion | exports.cookies = (cookie)->
if cookie | all_cookies = cookie
client.global_cookies(all_cookies)
return all_cookies | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 19 | 23 |
xhan/qqbot:src/qqapi.coffee:3:raw_corpus | raw_corpus | exports.defaults = (key,value)->
if key and value
defaults[key] = value
else if key
defaults[key]
else
defaults | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 25 | 31 | ||
xhan/qqbot:src/qqapi.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.defaults = (key,value)->
if key and value
defaults[key] = value
else if key
defaults[key]
else
defaults
``` | exports.defaults = function(key, value) {
if (key && value) {
return defaults[key] = value;
} else if (key) {
return defaults[key];
} else {
return defaults;
}
}; | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 25 | 31 |
xhan/qqbot:src/qqapi.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.defaults = function(key, value) {
if (key && value) {
return defaults[key] = value;
} else if (key) {
return defaults[key];
} else {
return defaults;
}
};
``` | exports.defaults = (key,value)->
if key and value
defaults[key] = value
else if key
defaults[key]
else
defaults | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 25 | 31 |
xhan/qqbot:src/qqapi.coffee:3:completion | completion | exports.defaults = (key,value)->
if key and value
defaults[key] = value | else if key
defaults[key]
else
defaults | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 25 | 31 |
xhan/qqbot:src/qqapi.coffee:4:raw_corpus | raw_corpus | exports.defaults_save = ->
defaults.cookie = all_cookies
fs.writeFileSync 'tmp/store.json' , jsons(defaults) | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 33 | 35 | ||
xhan/qqbot:src/qqapi.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.defaults_save = ->
defaults.cookie = all_cookies
fs.writeFileSync 'tmp/store.json' , jsons(defaults)
``` | exports.defaults_save = function() {
defaults.cookie = all_cookies;
return fs.writeFileSync('tmp/store.json', jsons(defaults));
}; | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 33 | 35 |
xhan/qqbot:src/qqapi.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.defaults_save = function() {
defaults.cookie = all_cookies;
return fs.writeFileSync('tmp/store.json', jsons(defaults));
};
``` | exports.defaults_save = ->
defaults.cookie = all_cookies
fs.writeFileSync 'tmp/store.json' , jsons(defaults) | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 33 | 35 |
xhan/qqbot:src/qqapi.coffee:5:raw_corpus | raw_corpus | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
client.global_cookies(all_cookies)
catch error
log error
# 长轮训,默认一分钟
# @param : [clientid,psessionid]
# @param callback: ret, e
# @return ret retcode 102,... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 37 | 49 | ||
xhan/qqbot:src/qqapi.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
client.global_cookies(all_cookies)
catch error
log error
# 长轮训,默认一分钟
# @param : [clientid,psessioni... | exports.defaults_read = function() {
var all_cookies, defaults, error;
try {
defaults = JSON.parse(fs.readFileSync('tmp/store.json'));
all_cookies = defaults.cookie;
return client.global_cookies(all_cookies);
} catch (error1) {
error = error1;
return log(error);
}
};
// 长轮训,默认一分钟
// @param... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 37 | 49 |
xhan/qqbot:src/qqapi.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.defaults_read = function() {
var all_cookies, defaults, error;
try {
defaults = JSON.parse(fs.readFileSync('tmp/store.json'));
all_cookies = defaults.cookie;
return client.global_cookies(all_cookies);
} catch (error1) {
error = error1;... | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
client.global_cookies(all_cookies)
catch error
log error
# 长轮训,默认一分钟
# @param : [clientid,psessionid]
# @param callback: ret, e
# @return ret retcode 102,... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 37 | 49 |
xhan/qqbot:src/qqapi.coffee:5:completion | completion | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
client.global_cookies(all_cookies)
catch error | log error
# 长轮训,默认一分钟
# @param : [clientid,psessionid]
# @param callback: ret, e
# @return ret retcode 102,正常空消息 | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 9e5f3a3b4c82ccd72705864f8bab903b30eb49da | 1,435 | https://github.com/xhan/qqbot/blob/9e5f3a3b4c82ccd72705864f8bab903b30eb49da/src/qqapi.coffee | 37 | 49 |
xhan/qqbot:src/qqapi.coffee:10:raw_corpus | raw_corpus | exports.send_msg_2buddy = (to_uin , msg , auth_opts ,callback)->
url = "http://d.web2.qq.com/channel/send_buddy_msg2"
opt = auth_opts
r =
to: to_uin
face: 0
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font",... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 7b1204344c42d3c5b585baaa1d43c0ebba1036dd | 1,435 | https://github.com/xhan/qqbot/blob/7b1204344c42d3c5b585baaa1d43c0ebba1036dd/src/qqapi.coffee | 136 | 160 | ||
xhan/qqbot:src/qqapi.coffee:10:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.send_msg_2buddy = (to_uin , msg , auth_opts ,callback)->
url = "http://d.web2.qq.com/channel/send_buddy_msg2"
opt = auth_opts
r =
to: to_uin
face: 0
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid:... | exports.send_msg_2buddy = function(to_uin, msg, auth_opts, callback) {
var opt, params, r, url;
url = "http://d.web2.qq.com/channel/send_buddy_msg2";
opt = auth_opts;
r = {
to: to_uin,
face: 0,
msg_id: 1000001, //随机msgid
clientid: `${opt.clientid}`,
psessionid: opt.psessionid,
content: j... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 7b1204344c42d3c5b585baaa1d43c0ebba1036dd | 1,435 | https://github.com/xhan/qqbot/blob/7b1204344c42d3c5b585baaa1d43c0ebba1036dd/src/qqapi.coffee | 136 | 160 |
xhan/qqbot:src/qqapi.coffee:10:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.send_msg_2buddy = function(to_uin, msg, auth_opts, callback) {
var opt, params, r, url;
url = "http://d.web2.qq.com/channel/send_buddy_msg2";
opt = auth_opts;
r = {
to: to_uin,
face: 0,
msg_id: 1000001, //随机msgid
clientid: `${opt.cli... | exports.send_msg_2buddy = (to_uin , msg , auth_opts ,callback)->
url = "http://d.web2.qq.com/channel/send_buddy_msg2"
opt = auth_opts
r =
to: to_uin
face: 0
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font",... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 7b1204344c42d3c5b585baaa1d43c0ebba1036dd | 1,435 | https://github.com/xhan/qqbot/blob/7b1204344c42d3c5b585baaa1d43c0ebba1036dd/src/qqapi.coffee | 136 | 160 |
xhan/qqbot:src/qqapi.coffee:10:completion | completion | exports.send_msg_2buddy = (to_uin , msg , auth_opts ,callback)->
url = "http://d.web2.qq.com/channel/send_buddy_msg2"
opt = auth_opts
r =
to: to_uin
face: 0
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font",... | r: jsons r
clientid: opt.clientid
psessionid: opt.psessionid
# log params
client.post {url:url} , params , (ret,e) ->
callback( ret , e )
# @param group_code: gid
# @param msg, 消息
# @param auth_opts: [clientid,psessionid]
# @param callback: ret, e
# @return ret retcode 0 | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 7b1204344c42d3c5b585baaa1d43c0ebba1036dd | 1,435 | https://github.com/xhan/qqbot/blob/7b1204344c42d3c5b585baaa1d43c0ebba1036dd/src/qqapi.coffee | 136 | 160 |
xhan/qqbot:src/qqapi.coffee:11:raw_corpus | raw_corpus | exports.send_msg_2group = (group_code, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: group_code
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" ... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 7b1204344c42d3c5b585baaa1d43c0ebba1036dd | 1,435 | https://github.com/xhan/qqbot/blob/7b1204344c42d3c5b585baaa1d43c0ebba1036dd/src/qqapi.coffee | 161 | 175 | ||
xhan/qqbot:src/qqapi.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.send_msg_2group = (group_code, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: group_code
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
pses... | exports.send_msg_2group = function(group_code, msg, auth_opts, callback) {
var opt, params, r, url;
url = 'http://d.web2.qq.com/channel/send_qun_msg2';
opt = auth_opts;
r = {
group_uin: group_code,
msg_id: 1000001, //随机msgid
clientid: `${opt.clientid}`,
psessionid: opt.psessionid,
content: j... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 7b1204344c42d3c5b585baaa1d43c0ebba1036dd | 1,435 | https://github.com/xhan/qqbot/blob/7b1204344c42d3c5b585baaa1d43c0ebba1036dd/src/qqapi.coffee | 161 | 175 |
xhan/qqbot:src/qqapi.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.send_msg_2group = function(group_code, msg, auth_opts, callback) {
var opt, params, r, url;
url = 'http://d.web2.qq.com/channel/send_qun_msg2';
opt = auth_opts;
r = {
group_uin: group_code,
msg_id: 1000001, //随机msgid
clientid: `${opt.cli... | exports.send_msg_2group = (group_code, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: group_code
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}"
psessionid: opt.psessionid
content: jsons ["#{msg}" ... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 7b1204344c42d3c5b585baaa1d43c0ebba1036dd | 1,435 | https://github.com/xhan/qqbot/blob/7b1204344c42d3c5b585baaa1d43c0ebba1036dd/src/qqapi.coffee | 161 | 175 |
xhan/qqbot:src/qqapi.coffee:11:completion | completion | exports.send_msg_2group = (group_code, msg , auth_opts, callback)->
url = 'http://d.web2.qq.com/channel/send_qun_msg2'
opt = auth_opts
r =
group_uin: group_code
msg_id: 1000001 #随机msgid
clientid: "#{opt.clientid}" | psessionid: opt.psessionid
content: jsons ["#{msg}" , ["font", {name:"宋体", size:"10", style:[0,0,0], color:"000000" }] ]
params =
r: jsons r
clientid: opt.clientid
psessionid:opt.psessionid
client.post {url:url} , params , (ret,e)->
callback(ret,e) | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 7b1204344c42d3c5b585baaa1d43c0ebba1036dd | 1,435 | https://github.com/xhan/qqbot/blob/7b1204344c42d3c5b585baaa1d43c0ebba1036dd/src/qqapi.coffee | 161 | 175 |
xhan/qqbot:src/qqapi.coffee:9:raw_corpus | raw_corpus | exports.get_group_member = (group_code, auth_opts, callback)->
url = "http://s.web2.qq.com/api/get_group_info_ext2"
url += "?gcode=#{group_code}&cb=undefined&vfwebqq=#{auth_opts.vfwebqq}&t=#{new Date().getTime()}"
client.get {url:url}, (ret,e)->
ret = jsons ret if ret
callback(jsons ret,e)
... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | c204832f57b62faf1ea08b14df05e9bbefedbdd1 | 1,435 | https://github.com/xhan/qqbot/blob/c204832f57b62faf1ea08b14df05e9bbefedbdd1/src/qqapi.coffee | 124 | 136 | ||
xhan/qqbot:src/qqapi.coffee:9:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.get_group_member = (group_code, auth_opts, callback)->
url = "http://s.web2.qq.com/api/get_group_info_ext2"
url += "?gcode=#{group_code}&cb=undefined&vfwebqq=#{auth_opts.vfwebqq}&t=#{new Date().getTime()}"
client.get {url:url}, (ret,e)->
... | exports.get_group_member = function(group_code, auth_opts, callback) {
var url;
url = "http://s.web2.qq.com/api/get_group_info_ext2";
url += `?gcode=${group_code}&cb=undefined&vfwebqq=${auth_opts.vfwebqq}&t=${new Date().getTime()}`;
return client.get({
url: url
}, function(ret, e) {
if (ret) {
r... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | c204832f57b62faf1ea08b14df05e9bbefedbdd1 | 1,435 | https://github.com/xhan/qqbot/blob/c204832f57b62faf1ea08b14df05e9bbefedbdd1/src/qqapi.coffee | 124 | 136 |
xhan/qqbot:src/qqapi.coffee:9:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.get_group_member = function(group_code, auth_opts, callback) {
var url;
url = "http://s.web2.qq.com/api/get_group_info_ext2";
url += `?gcode=${group_code}&cb=undefined&vfwebqq=${auth_opts.vfwebqq}&t=${new Date().getTime()}`;
return client.get({
... | exports.get_group_member = (group_code, auth_opts, callback)->
url = "http://s.web2.qq.com/api/get_group_info_ext2"
url += "?gcode=#{group_code}&cb=undefined&vfwebqq=#{auth_opts.vfwebqq}&t=#{new Date().getTime()}"
client.get {url:url}, (ret,e)->
ret = jsons ret if ret
callback(jsons ret,e)
... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | c204832f57b62faf1ea08b14df05e9bbefedbdd1 | 1,435 | https://github.com/xhan/qqbot/blob/c204832f57b62faf1ea08b14df05e9bbefedbdd1/src/qqapi.coffee | 124 | 136 |
xhan/qqbot:src/qqapi.coffee:7:raw_corpus | raw_corpus | exports.get_friend_list = (uin, ptwebqq, vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_user_friends2"
r =
h: "hello"
hash: hash_func(uin, ptwebqq)
vfwebqq: vfwebqq
client.post {url:aurl} , {r:jsons(r)} , (ret,e )->
callback(ret,e)
# @param vfwebqq : 登录后获得
# @param ... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 96 | 109 | ||
xhan/qqbot:src/qqapi.coffee:7:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.get_friend_list = (uin, ptwebqq, vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_user_friends2"
r =
h: "hello"
hash: hash_func(uin, ptwebqq)
vfwebqq: vfwebqq
client.post {url:aurl} , {r:jsons(r)} , (ret,e )->
... | exports.get_friend_list = function(uin, ptwebqq, vfwebqq, callback) {
var aurl, r;
aurl = "http://s.web2.qq.com/api/get_user_friends2";
r = {
h: "hello",
hash: hash_func(uin, ptwebqq),
vfwebqq: vfwebqq
};
return client.post({
url: aurl
}, {
r: jsons(r)
}, function(ret, e) {
return ... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 96 | 109 |
xhan/qqbot:src/qqapi.coffee:7:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.get_friend_list = function(uin, ptwebqq, vfwebqq, callback) {
var aurl, r;
aurl = "http://s.web2.qq.com/api/get_user_friends2";
r = {
h: "hello",
hash: hash_func(uin, ptwebqq),
vfwebqq: vfwebqq
};
return client.post({
url: aurl
}... | exports.get_friend_list = (uin, ptwebqq, vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_user_friends2"
r =
h: "hello"
hash: hash_func(uin, ptwebqq)
vfwebqq: vfwebqq
client.post {url:aurl} , {r:jsons(r)} , (ret,e )->
callback(ret,e)
# @param vfwebqq : 登录后获得
# @param ... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 96 | 109 |
xhan/qqbot:src/qqapi.coffee:7:completion | completion | exports.get_friend_list = (uin, ptwebqq, vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_user_friends2"
r =
h: "hello"
hash: hash_func(uin, ptwebqq)
vfwebqq: vfwebqq | client.post {url:aurl} , {r:jsons(r)} , (ret,e )->
callback(ret,e)
# @param vfwebqq : 登录后获得
# @param callback: ret, e
# retcode 0 | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 96 | 109 |
xhan/qqbot:src/qqapi.coffee:8:raw_corpus | raw_corpus | exports.get_group_list = ( vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2"
r = vfwebqq: vfwebqq
r = JSON.stringify r
client.post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e)
# @param group_code: code
# @param vfwebqq : 登录后获得
# @param callback: ret,... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 110 | 121 | ||
xhan/qqbot:src/qqapi.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.get_group_list = ( vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2"
r = vfwebqq: vfwebqq
r = JSON.stringify r
client.post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e)
# @param group_code... | exports.get_group_list = function(vfwebqq, callback) {
var aurl, r;
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2";
r = {
vfwebqq: vfwebqq
};
r = JSON.stringify(r);
return client.post({
url: aurl
}, {
r: r
}, function(ret, e) {
return callback(ret, e);
});
};
// @param g... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 110 | 121 |
xhan/qqbot:src/qqapi.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.get_group_list = function(vfwebqq, callback) {
var aurl, r;
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2";
r = {
vfwebqq: vfwebqq
};
r = JSON.stringify(r);
return client.post({
url: aurl
}, {
r: r
}, function(ret, e... | exports.get_group_list = ( vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2"
r = vfwebqq: vfwebqq
r = JSON.stringify r
client.post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e)
# @param group_code: code
# @param vfwebqq : 登录后获得
# @param callback: ret,... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 110 | 121 |
xhan/qqbot:src/qqapi.coffee:8:completion | completion | exports.get_group_list = ( vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2"
r = vfwebqq: vfwebqq
r = JSON.stringify r
client.post {url:aurl} , {r:r} , (ret,e )-> | callback(ret,e)
# @param group_code: code
# @param vfwebqq : 登录后获得
# @param callback: ret, e
# retcode 0 | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 110 | 121 |
xhan/qqbot:src/qqapi.coffee:9:raw_corpus | raw_corpus | exports.get_group_member = (group_code, vfwebqq, callback)->
url = "http://s.web2.qq.com/api/get_group_info_ext2"
url += "?gcode=#{group_code}&cb=undefined&vfwebqq=#{vfwebqq}&t=#{new Date().getTime()}"
client.get {url:url}, (ret,e)->
callback(ret,e)
# @param to_uin: uin
# @param msg, 消息
# @par... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 122 | 134 | ||
xhan/qqbot:src/qqapi.coffee:9:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.get_group_member = (group_code, vfwebqq, callback)->
url = "http://s.web2.qq.com/api/get_group_info_ext2"
url += "?gcode=#{group_code}&cb=undefined&vfwebqq=#{vfwebqq}&t=#{new Date().getTime()}"
client.get {url:url}, (ret,e)->
callback(... | exports.get_group_member = function(group_code, vfwebqq, callback) {
var url;
url = "http://s.web2.qq.com/api/get_group_info_ext2";
url += `?gcode=${group_code}&cb=undefined&vfwebqq=${vfwebqq}&t=${new Date().getTime()}`;
return client.get({
url: url
}, function(ret, e) {
return callback(ret, e);
});... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 122 | 134 |
xhan/qqbot:src/qqapi.coffee:9:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.get_group_member = function(group_code, vfwebqq, callback) {
var url;
url = "http://s.web2.qq.com/api/get_group_info_ext2";
url += `?gcode=${group_code}&cb=undefined&vfwebqq=${vfwebqq}&t=${new Date().getTime()}`;
return client.get({
url: url
}... | exports.get_group_member = (group_code, vfwebqq, callback)->
url = "http://s.web2.qq.com/api/get_group_info_ext2"
url += "?gcode=#{group_code}&cb=undefined&vfwebqq=#{vfwebqq}&t=#{new Date().getTime()}"
client.get {url:url}, (ret,e)->
callback(ret,e)
# @param to_uin: uin
# @param msg, 消息
# @par... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 16c139bfde326ad831413e84213cd7587c0ca50a | 1,435 | https://github.com/xhan/qqbot/blob/16c139bfde326ad831413e84213cd7587c0ca50a/src/qqapi.coffee | 122 | 134 |
xhan/qqbot:src/qqapi.coffee:2:raw_corpus | raw_corpus | exports.cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 2cf2a0685b265234aaac0c66591ebe5f5242d9d9 | 1,435 | https://github.com/xhan/qqbot/blob/2cf2a0685b265234aaac0c66591ebe5f5242d9d9/src/qqapi.coffee | 19 | 21 | ||
xhan/qqbot:src/qqapi.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies
``` | exports.cookies = function(cookie) {
var all_cookies;
if (cookie) {
all_cookies = cookie;
}
return all_cookies;
}; | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 2cf2a0685b265234aaac0c66591ebe5f5242d9d9 | 1,435 | https://github.com/xhan/qqbot/blob/2cf2a0685b265234aaac0c66591ebe5f5242d9d9/src/qqapi.coffee | 19 | 21 |
xhan/qqbot:src/qqapi.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.cookies = function(cookie) {
var all_cookies;
if (cookie) {
all_cookies = cookie;
}
return all_cookies;
};
``` | exports.cookies = (cookie)->
all_cookies = cookie if cookie
return all_cookies | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 2cf2a0685b265234aaac0c66591ebe5f5242d9d9 | 1,435 | https://github.com/xhan/qqbot/blob/2cf2a0685b265234aaac0c66591ebe5f5242d9d9/src/qqapi.coffee | 19 | 21 |
xhan/qqbot:src/qqapi.coffee:5:raw_corpus | raw_corpus | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
# 设置httpclient cookie
client.global_cookies(all_cookies)
catch error
log error
# 长轮训,默认一分钟
# @param : [clientid,psessionid]
# @param callback: ret,... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 2cf2a0685b265234aaac0c66591ebe5f5242d9d9 | 1,435 | https://github.com/xhan/qqbot/blob/2cf2a0685b265234aaac0c66591ebe5f5242d9d9/src/qqapi.coffee | 35 | 48 | ||
xhan/qqbot:src/qqapi.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
# 设置httpclient cookie
client.global_cookies(all_cookies)
catch error
log error
# 长轮训,默认一分钟
#... | exports.defaults_read = function() {
var all_cookies, defaults, error;
try {
defaults = JSON.parse(fs.readFileSync('tmp/store.json'));
all_cookies = defaults.cookie;
// 设置httpclient cookie
return client.global_cookies(all_cookies);
} catch (error1) {
error = error1;
return log(error);
}
... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 2cf2a0685b265234aaac0c66591ebe5f5242d9d9 | 1,435 | https://github.com/xhan/qqbot/blob/2cf2a0685b265234aaac0c66591ebe5f5242d9d9/src/qqapi.coffee | 35 | 48 |
xhan/qqbot:src/qqapi.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.defaults_read = function() {
var all_cookies, defaults, error;
try {
defaults = JSON.parse(fs.readFileSync('tmp/store.json'));
all_cookies = defaults.cookie;
// 设置httpclient cookie
return client.global_cookies(all_cookies);
} catch (er... | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
# 设置httpclient cookie
client.global_cookies(all_cookies)
catch error
log error
# 长轮训,默认一分钟
# @param : [clientid,psessionid]
# @param callback: ret,... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 2cf2a0685b265234aaac0c66591ebe5f5242d9d9 | 1,435 | https://github.com/xhan/qqbot/blob/2cf2a0685b265234aaac0c66591ebe5f5242d9d9/src/qqapi.coffee | 35 | 48 |
xhan/qqbot:src/qqapi.coffee:5:completion | completion | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
# 设置httpclient cookie
client.global_cookies(all_cookies)
catch error | log error
# 长轮训,默认一分钟
# @param : [clientid,psessionid]
# @param callback: ret, e
# @return ret retcode 102,正常空消息 | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 2cf2a0685b265234aaac0c66591ebe5f5242d9d9 | 1,435 | https://github.com/xhan/qqbot/blob/2cf2a0685b265234aaac0c66591ebe5f5242d9d9/src/qqapi.coffee | 35 | 48 |
xhan/qqbot:src/qqapi.coffee:4:raw_corpus | raw_corpus | exports.defaults_save = ->
defaults.cookie = all_cookies
fs.writeFileSync 'tmp/store.json' , JSON.stringify(defaults) | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 29 | 31 | ||
xhan/qqbot:src/qqapi.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.defaults_save = ->
defaults.cookie = all_cookies
fs.writeFileSync 'tmp/store.json' , JSON.stringify(defaults)
``` | exports.defaults_save = function() {
defaults.cookie = all_cookies;
return fs.writeFileSync('tmp/store.json', JSON.stringify(defaults));
}; | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 29 | 31 |
xhan/qqbot:src/qqapi.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.defaults_save = function() {
defaults.cookie = all_cookies;
return fs.writeFileSync('tmp/store.json', JSON.stringify(defaults));
};
``` | exports.defaults_save = ->
defaults.cookie = all_cookies
fs.writeFileSync 'tmp/store.json' , JSON.stringify(defaults) | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 29 | 31 |
xhan/qqbot:src/qqapi.coffee:5:raw_corpus | raw_corpus | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
catch error
log error
# 长轮训,默认一分钟
# r: {"clientid":"25837476","psessionid":"8368046764001d636f6e6e7365727665725f77656271714031302e3133392e372e31363000007190000001d403... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 33 | 44 | ||
xhan/qqbot:src/qqapi.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
catch error
log error
# 长轮训,默认一分钟
# r: {"clientid":"25837476","psessionid":"8368046764001d636f6e6e73657276657... | exports.defaults_read = function() {
var all_cookies, defaults, error;
try {
defaults = JSON.parse(fs.readFileSync('tmp/store.json'));
return all_cookies = defaults.cookie;
} catch (error1) {
error = error1;
return log(error);
}
};
// 长轮训,默认一分钟
// r: {"clientid":"25837476","psessionid":"8368046... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 33 | 44 |
xhan/qqbot:src/qqapi.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.defaults_read = function() {
var all_cookies, defaults, error;
try {
defaults = JSON.parse(fs.readFileSync('tmp/store.json'));
return all_cookies = defaults.cookie;
} catch (error1) {
error = error1;
return log(error);
}
};
// 长轮训,默... | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
all_cookies = defaults.cookie
catch error
log error
# 长轮训,默认一分钟
# r: {"clientid":"25837476","psessionid":"8368046764001d636f6e6e7365727665725f77656271714031302e3133392e372e31363000007190000001d403... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 33 | 44 |
xhan/qqbot:src/qqapi.coffee:6:raw_corpus | raw_corpus | long_poll = (client_id, psessionid, callback) ->
log "polling..."
aurl = Url.parse "http://d.web2.qq.com/channel/poll2"
r =
clientid: "#{client_id}"
psessionid: psessionid
key:0
ids:[]
r = JSON.stringify(r)
data = querystring.stringify {
clientid: client_id,
... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 45 | 94 | ||
xhan/qqbot:src/qqapi.coffee:6:completion | completion | long_poll = (client_id, psessionid, callback) ->
log "polling..."
aurl = Url.parse "http://d.web2.qq.com/channel/poll2"
r =
clientid: "#{client_id}"
psessionid: psessionid
key:0
ids:[]
r = JSON.stringify(r)
data = querystring.stringify {
clientid: client_id,
... | 'Content-Length': Buffer.byteLength(data)
'Cookie' : all_cookies
req = http.request options, (resp) ->
log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
log body
ret = JSON.parse(body)
ca... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 45 | 94 |
xhan/qqbot:src/qqapi.coffee:7:raw_corpus | raw_corpus | for (var a = [], s = 0; s < i.length; s++) a[s % 4] ^= i.charCodeAt(s);
var j = ["EC", "OK"],
d = [];
d[0] = b >> 24 & 255 ^ j[0].charCodeAt(0);
d[1] = b >> 16 & 255 ^ j[0].charCodeAt(1);
d[2] = b >> 8 & 255 ^ j[1].charCodeAt(0);
... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 95 | 110 | ||
xhan/qqbot:src/qqapi.coffee:7:completion | completion | for (var a = [], s = 0; s < i.length; s++) a[s % 4] ^= i.charCodeAt(s);
var j = ["EC", "OK"],
d = [];
d[0] = b >> 24 & 255 ^ j[0].charCodeAt(0);
d[1] = b >> 16 & 255 ^ j[0].charCodeAt(1);
d[2] = b >> 8 & 255 ^ j[1].charCodeAt(0);
... | for (s = 0; s < 8; s++) j[s] = s % 2 == 0 ? a[s >> 1] : d[s >> 1];
a = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
d = "";
for (s = 0; s < j.length; s++) d += a[j[s] >> 4 & 15], d += a[j[s] & 15];
return d
}
`
# callba... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 95 | 110 |
xhan/qqbot:src/qqapi.coffee:8:raw_corpus | raw_corpus | http_request = (options , params , callback) ->
aurl = Url.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.st... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 111 | 139 | ||
xhan/qqbot:src/qqapi.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
http_request = (options , params , callback) ->
aurl = Url.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params a... | var http_request;
http_request = function(options, params, callback) {
var aurl, body, client, data, req;
aurl = Url.parse(options.url);
options.host = aurl.host;
options.path = aurl.path;
options.headers || (options.headers = {});
client = aurl.protocol === 'https:' ? https : http;
body = '';
if (para... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 111 | 139 |
xhan/qqbot:src/qqapi.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var http_request;
http_request = function(options, params, callback) {
var aurl, body, client, data, req;
aurl = Url.parse(options.url);
options.host = aurl.host;
options.path = aurl.path;
options.headers || (options.headers = {});
client = aurl.protoc... | http_request = (options , params , callback) ->
aurl = Url.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.st... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 111 | 139 |
xhan/qqbot:src/qqapi.coffee:8:completion | completion | http_request = (options , params , callback) ->
aurl = Url.parse( options.url )
options.host = aurl.host
options.path = aurl.path
options.headers ||= {}
client = if aurl.protocol == 'https:' then https else http
body = ''
if params and options.method == 'POST'
data = querystring.st... | options.headers['Referer'] = 'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3'
req = client.request options, (resp) ->
# log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
callback( body )
req.on "error" , ... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 111 | 139 |
xhan/qqbot:src/qqapi.coffee:9:raw_corpus | raw_corpus | http_get = (options , callback) ->
options.method = 'GET'
http_request( options , null , callback) | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 142 | 144 | ||
xhan/qqbot:src/qqapi.coffee:9:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
http_get = (options , callback) ->
options.method = 'GET'
http_request( options , null , callback)
``` | var http_get;
http_get = function(options, callback) {
options.method = 'GET';
return http_request(options, null, callback);
}; | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 142 | 144 |
xhan/qqbot:src/qqapi.coffee:9:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var http_get;
http_get = function(options, callback) {
options.method = 'GET';
return http_request(options, null, callback);
};
``` | http_get = (options , callback) ->
options.method = 'GET'
http_request( options , null , callback) | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 142 | 144 |
xhan/qqbot:src/qqapi.coffee:10:raw_corpus | raw_corpus | http_post = (options , body, callback) ->
options.method = 'POST'
http_request( options , body , callback)
# @param uin : 登录后获得
# @param ptwebqq : cookie
# @param vfwebqq : 登录后获得
# @param callback: ret, e | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 146 | 153 | ||
xhan/qqbot:src/qqapi.coffee:10:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
http_post = (options , body, callback) ->
options.method = 'POST'
http_request( options , body , callback)
# @param uin : 登录后获得
# @param ptwebqq : cookie
# @param vfwebqq : 登录后获得
# @param callback: ret, e
``` | var http_post;
http_post = function(options, body, callback) {
options.method = 'POST';
return http_request(options, body, callback);
};
// @param uin : 登录后获得
// @param ptwebqq : cookie
// @param vfwebqq : 登录后获得
// @param callback: ret, e | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 146 | 153 |
xhan/qqbot:src/qqapi.coffee:10:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var http_post;
http_post = function(options, body, callback) {
options.method = 'POST';
return http_request(options, body, callback);
};
// @param uin : 登录后获得
// @param ptwebqq : cookie
// @param vfwebqq : 登录后获得
// @param callback: ret, e
``` | http_post = (options , body, callback) ->
options.method = 'POST'
http_request( options , body , callback)
# @param uin : 登录后获得
# @param ptwebqq : cookie
# @param vfwebqq : 登录后获得
# @param callback: ret, e | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 146 | 153 |
xhan/qqbot:src/qqapi.coffee:11:raw_corpus | raw_corpus | exports.get_friend_list = (uin, ptwebqq, vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_user_friends2"
r =
h: "hello"
hash: hash_func(uin, ptwebqq)
vfwebqq: vfwebqq
r = JSON.stringify(r)
http_post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e)
# @param vfwebqq :... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 154 | 167 | ||
xhan/qqbot:src/qqapi.coffee:11:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.get_friend_list = (uin, ptwebqq, vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_user_friends2"
r =
h: "hello"
hash: hash_func(uin, ptwebqq)
vfwebqq: vfwebqq
r = JSON.stringify(r)
http_post {url:aurl} , {r:r} ,... | exports.get_friend_list = function(uin, ptwebqq, vfwebqq, callback) {
var aurl, r;
aurl = "http://s.web2.qq.com/api/get_user_friends2";
r = {
h: "hello",
hash: hash_func(uin, ptwebqq),
vfwebqq: vfwebqq
};
r = JSON.stringify(r);
return http_post({
url: aurl
}, {
r: r
}, function(ret, ... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 154 | 167 |
xhan/qqbot:src/qqapi.coffee:11:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.get_friend_list = function(uin, ptwebqq, vfwebqq, callback) {
var aurl, r;
aurl = "http://s.web2.qq.com/api/get_user_friends2";
r = {
h: "hello",
hash: hash_func(uin, ptwebqq),
vfwebqq: vfwebqq
};
r = JSON.stringify(r);
return http_p... | exports.get_friend_list = (uin, ptwebqq, vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_user_friends2"
r =
h: "hello"
hash: hash_func(uin, ptwebqq)
vfwebqq: vfwebqq
r = JSON.stringify(r)
http_post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e)
# @param vfwebqq :... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 154 | 167 |
xhan/qqbot:src/qqapi.coffee:11:completion | completion | exports.get_friend_list = (uin, ptwebqq, vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_user_friends2"
r =
h: "hello"
hash: hash_func(uin, ptwebqq)
vfwebqq: vfwebqq
r = JSON.stringify(r) | http_post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e)
# @param vfwebqq : 登录后获得
# @param callback: ret, e | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 154 | 167 |
xhan/qqbot:src/qqapi.coffee:12:raw_corpus | raw_corpus | exports.get_group_list = ( vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2"
r =
vfwebqq: vfwebqq
r = JSON.stringify r
http_post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e) | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 168 | 174 | ||
xhan/qqbot:src/qqapi.coffee:12:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.get_group_list = ( vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2"
r =
vfwebqq: vfwebqq
r = JSON.stringify r
http_post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e)
``` | exports.get_group_list = function(vfwebqq, callback) {
var aurl, r;
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2";
r = {
vfwebqq: vfwebqq
};
r = JSON.stringify(r);
return http_post({
url: aurl
}, {
r: r
}, function(ret, e) {
return callback(ret, e);
});
}; | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 168 | 174 |
xhan/qqbot:src/qqapi.coffee:12:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.get_group_list = function(vfwebqq, callback) {
var aurl, r;
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2";
r = {
vfwebqq: vfwebqq
};
r = JSON.stringify(r);
return http_post({
url: aurl
}, {
r: r
}, function(ret, e) ... | exports.get_group_list = ( vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2"
r =
vfwebqq: vfwebqq
r = JSON.stringify r
http_post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e) | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 168 | 174 |
xhan/qqbot:src/qqapi.coffee:12:completion | completion | exports.get_group_list = ( vfwebqq, callback)->
aurl = "http://s.web2.qq.com/api/get_group_name_list_mask2"
r = | vfwebqq: vfwebqq
r = JSON.stringify r
http_post {url:aurl} , {r:r} , (ret,e )->
callback(ret,e) | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 3a214d86b5bfcd77af8dab465e01366790f1b82a | 1,435 | https://github.com/xhan/qqbot/blob/3a214d86b5bfcd77af8dab465e01366790f1b82a/src/qqapi.coffee | 168 | 174 |
xhan/qqbot:src/qqapi.coffee:5:raw_corpus | raw_corpus | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
catch error
log error
# 长轮训,默认一分钟
# r: {"clientid":"25837476","psessionid":"8368046764001d636f6e6e7365727665725f77656271714031302e3133392e372e31363000007190000001d4036e040018ed13a56d0000000a404135396759427... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 603eb7e07d8eee1868bf930c335d7a1b6c6f78e5 | 1,435 | https://github.com/xhan/qqbot/blob/603eb7e07d8eee1868bf930c335d7a1b6c6f78e5/src/qqapi.coffee | 33 | 43 | ||
xhan/qqbot:src/qqapi.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
catch error
log error
# 长轮训,默认一分钟
# r: {"clientid":"25837476","psessionid":"8368046764001d636f6e6e7365727665725f77656271714031302e3133392e372e313630... | exports.defaults_read = function() {
var defaults, error;
try {
return defaults = JSON.parse(fs.readFileSync('tmp/store.json'));
} catch (error1) {
error = error1;
return log(error);
}
};
// 长轮训,默认一分钟
// r: {"clientid":"25837476","psessionid":"8368046764001d636f6e6e7365727665725f77656271714031302e3... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | 603eb7e07d8eee1868bf930c335d7a1b6c6f78e5 | 1,435 | https://github.com/xhan/qqbot/blob/603eb7e07d8eee1868bf930c335d7a1b6c6f78e5/src/qqapi.coffee | 33 | 43 |
xhan/qqbot:src/qqapi.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
exports.defaults_read = function() {
var defaults, error;
try {
return defaults = JSON.parse(fs.readFileSync('tmp/store.json'));
} catch (error1) {
error = error1;
return log(error);
}
};
// 长轮训,默认一分钟
// r: {"clientid":"25837476","psessionid":"... | exports.defaults_read = ->
try
defaults = JSON.parse( fs.readFileSync 'tmp/store.json' )
catch error
log error
# 长轮训,默认一分钟
# r: {"clientid":"25837476","psessionid":"8368046764001d636f6e6e7365727665725f77656271714031302e3133392e372e31363000007190000001d4036e040018ed13a56d0000000a404135396759427... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | 603eb7e07d8eee1868bf930c335d7a1b6c6f78e5 | 1,435 | https://github.com/xhan/qqbot/blob/603eb7e07d8eee1868bf930c335d7a1b6c6f78e5/src/qqapi.coffee | 33 | 43 |
xhan/qqbot:src/qqapi.coffee:1:raw_corpus | raw_corpus | https = require "https"
http = require 'http'
crypto = require 'crypto'
querystring = require 'querystring'
Url = require('url')
all_cookies = []
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
exports.cookies = (cookie)->
all_coo... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07 | 1,435 | https://github.com/xhan/qqbot/blob/d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07/src/qqapi.coffee | 1 | 50 | ||
xhan/qqbot:src/qqapi.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
https = require "https"
http = require 'http'
crypto = require 'crypto'
querystring = require 'querystring'
Url = require('url')
all_cookies = []
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log ... | var Url, all_cookies, crypto, http, https, log, long_poll, md5, querystring;
https = require("https");
http = require('http');
crypto = require('crypto');
querystring = require('querystring');
Url = require('url');
all_cookies = [];
md5 = function(str) {
var md5sum;
md5sum = crypto.createHash('md5');
retur... | CoffeeScript | JavaScript | xhan/qqbot | src/qqapi.coffee | MIT | d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07 | 1,435 | https://github.com/xhan/qqbot/blob/d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07/src/qqapi.coffee | 1 | 50 |
xhan/qqbot:src/qqapi.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Url, all_cookies, crypto, http, https, log, long_poll, md5, querystring;
https = require("https");
http = require('http');
crypto = require('crypto');
querystring = require('querystring');
Url = require('url');
all_cookies = [];
md5 = function(str) {
v... | https = require "https"
http = require 'http'
crypto = require 'crypto'
querystring = require 'querystring'
Url = require('url')
all_cookies = []
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
exports.cookies = (cookie)->
all_coo... | JavaScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07 | 1,435 | https://github.com/xhan/qqbot/blob/d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07/src/qqapi.coffee | 1 | 50 |
xhan/qqbot:src/qqapi.coffee:1:completion | completion | https = require "https"
http = require 'http'
crypto = require 'crypto'
querystring = require 'querystring'
Url = require('url')
all_cookies = []
md5 = (str) ->
md5sum = crypto.createHash 'md5'
md5sum.update(str).digest('hex')
# TODO: logger 分级控制
log = console.log
exports.cookies = (cookie)->
all_coo... | url = Url.parse "http://d.web2.qq.com/channel/poll2"
r =
clientid: "#{client_id}",
psessionid: psessionid,
key:0,
ids:[]
r = JSON.stringify(r)
data = querystring.stringify {
clientid: client_id,
psessionid: psessionid,
r: r
}
body = ''
op... | CoffeeScript | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07 | 1,435 | https://github.com/xhan/qqbot/blob/d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07/src/qqapi.coffee | 1 | 50 |
xhan/qqbot:src/qqapi.coffee:2:raw_corpus | raw_corpus | req = http.request options, (resp) ->
log "response: #{resp.statusCode}"
resp.on 'data', (chunk) ->
body += chunk
resp.on 'end', ->
ret = JSON.parse(body)
callback( ret )
long_poll(client_id , psessionid , callback)
req.write(data);
req.end... | CoffeeScript | xhan/qqbot | src/qqapi.coffee | MIT | d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07 | 1,435 | https://github.com/xhan/qqbot/blob/d11c6934d16cfdd64d5e1692e7e62ceb9a87ec07/src/qqapi.coffee | 51 | 63 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.