         else if message.type == 'buddy'
             @api.send_msg_2buddy message.from_uin , content , @auth , (ret,e)->
                 callback(ret,e) if callback
-    
+
     # 发送群消息
     send_message_to_group: (gid, content, callback)->
       log.info "send msg #{content} to group#{gid}"
       api.send_msg_2group  gid , content , @auth, (ret,e)->
         callback(ret,e) if callback
-    
+
     # 自杀
     die: (message,info)->
         log.error "QQBot die! message: #{message}" if message
         log.error "QQBot die! info #{JSON.stringify info}" if info
         process.exit(1)
-    
+
     # 处理poll返回的内容
     handle_poll_responce: (resp)->
         code = resp.retcode

          callback( ret.retcode == 0, e || 'retcode isnot 0' ) if callback

    # 获取好友列表
    update_buddy_list: (callback)->
        @api.get_buddy_list @auth , (ret,e)=>
            @save_buddy_info ret.result if ret.retcode == 0
            callback( ret.retcode == 0, e || 'retcode isnot 0' ) if callback
    
    # 更新群成员， 似乎获取不到群ID
    # @options {key:value} 
    # @callback (true/false , error)
    update_group_member: (options, callback)->
        group = @get_group(options)
        api.get_group_member group.code , @auth , (ret,e)=>
            if ret.retcode == 0
                @save_group_member(group,ret.result)
            callback(ret.retcode == 0 , e) if callback
    
    
    # 长轮训
    # @callback 
    runloop: (callback)->
      @api.long_poll @auth , (ret,e)=>
          @handle_poll_responce ret
          callback(ret,e) if callback
    
    # 回复消息
    # @param message 收到的message
    # @param content:string 回复信息

            msg.from_user = @get_user( msg.from_uin )
        msg


    # 监听特定群并返回群对象
    # @callback (group对象, error = null)

    listen_group : (name , callback) ->
      log.info 'fetching group list'
      @update_group_list (ret, e) =>
          log.info '√ group list fetched'

          log.info "fetching groupmember #{name}"
          @update_group_member {name:name} ,(ret,error)=>
              log.info '√ group memeber fetched'

              groupinfo = @get_group {name:name}
              group = new Group(@, groupinfo.gid)
              @dispatcher.add_listener [group,"dispatch"]
              callback group
