 
 auth      = require "./src/qqauth"
 api       = require "./src/qqapi"
-apiserver = require "./src/apiserver"
 QQBot     = require "./src/qqbot"
 defaults  = require './src/defaults'
 config    = require './config'

# 获取好友，群，群成员信息，然后进入守护模式
# TODO: 获取信息 + 守护模式 同步状态
run = ->
  # 设置api server
  apiserver.run(config['api-port'], config['api-token'])
  
  isneedlogin = process.argv.pop().trim() isnt 'nologin'    
  get_tokens isneedlogin , config , (cookies,auth_info)->
    bot = new QQBot(cookies,auth_info,config)

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

run()
