Sha256: 5a30bf3bf38a385431d3fcb15a3187b731b9ecba8303d71a9f20fc7132fd826b

Contents?: true

Size: 606 Bytes

Versions: 4

Compression:

Stored size: 606 Bytes

Contents

# encoding=utf-8
require 'json'
require_relative 'struct'
module OPQ
  class QqObj
    attr_accessor :plugins, :qq
    def initialize(qq, plugins)
      @qq = qq
      @plugins = plugins
    end
    def on_data_received(msg)
      msg_json = JSON.parse(msg)
      receive = OPQ::Msg.new(msg_json)
      @plugins.each do |p|
        # 1好友 2群组
        if receive.type == 1
          p.receive_qq(@qq, receive)
        elsif receive.type == 2 && receive.sender_uin != @qq && receive.msg_type != 732
          p.receive_group(@qq, receive)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
opqr-0.1.5 lib/opqr/qqobj.rb
opqr-0.1.4 lib/opqr/qqobj.rb
opqr-0.1.3 lib/opqr/qqobj.rb
opqr-0.1.2 lib/opqr/qqobj.rb