Skip to content

Commit

Permalink
Merge pull request #44 from floatinghotpot/coffee
Browse files Browse the repository at this point in the history
增加了对二维码认证登录的支持
  • Loading branch information
xhan committed Feb 15, 2016
2 parents 8ef9bf8 + 64c7818 commit f3b62a4
Show file tree
Hide file tree
Showing 3 changed files with 330 additions and 5 deletions.
9 changes: 8 additions & 1 deletion main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


log = new (require 'log')('debug')
auth = require "./src/qqauth"
auth = require "./src/qqauth_qrcode"
api = require "./src/qqapi"
QQBot = require "./src/qqbot"
defaults = require './src/defaults'
Expand Down Expand Up @@ -53,6 +53,13 @@ run = ->
unless ret
log.error "获取信息失败"
process.exit(1)

console.log "Group List:"
console.log " #{v.name} (#{v.gid})" for k, v of bot.group_info.gnamelist

console.log "Buddy List:"
console.log " #{v.nick} (#{v.uin})" for k, v of bot.buddy_info.info

log.info "Entering runloop, Enjoy!"
bot.runloop()

Expand Down
15 changes: 11 additions & 4 deletions plugins/apiserver.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,19 @@ class APIServer
on_sendmsg : (req,res,params)->
log.info "will send #{params.type} #{params.to} : #{params.msg}"
if params.type == 'buddy'
msg = "unimplement type #{params.type}"
log.warning msg
res.endjson {err:100,msg:msg}
user = params.to
@qqbot.send_message user, params.msg, (ret,e)->
resp_ret = {result:ret}
if e
resp_ret.err = 1
resp_ret.msg = "#{e}"
res.endjson resp_ret

else if params.type == 'group'
group = @qqbot.get_group {name:params.to}
if parseInt(params.to) > 0
group = params.to
else
group = @qqbot.get_group {name:params.to}
@qqbot.send_message_to_group group, params.msg, (ret,e)->
resp_ret = {result:ret}
if e
Expand Down
311 changes: 311 additions & 0 deletions src/qqauth_qrcode.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f3b62a4

Please sign in to comment.