 
     _create_message : (event)->
         value = event.value
-        msg = 
+        msg =
             content : value.content.slice(-1).pop().trim()
             time    : new Date(value.time * 1000)
             from_uin: value.from_uin
             type    : if value.group_code then 'group' else 'buddy'
             uid     : value.msg_id
-            
+
         if msg.type == 'group'
             msg.from_gid = msg.from_uin
             msg.group_code = value.group_code

        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

 为hubot专门使用，提供两个方法
 - send
 - on_message (content,send_fun, bot , message_info) ->
###
class Group
    constructor: (@bot,@gid)->
    send: (content , callback)->
        @bot.send_message_to_group  @gid , content , (ret,e)->
            callback(ret,e) if callback

    on_message: (@msg_cb)->
    dispatch: (content ,send, robot, message)->
        # log.debug 'dispatch',params[0],@msg_cb
        if message.from_gid == @gid and @msg_cb
            @msg_cb(content ,send, robot, message)


module.exports = QQBot