Sha256: 9f3a8ced8baa1c2e4f5a1d8ebd709b7c1cc63845db1a28a1c29af8a5541b442b

Contents?: true

Size: 1014 Bytes

Versions: 2

Compression:

Stored size: 1014 Bytes

Contents

module DingBot
  module Message

    # text类型
    # {
    #     "msgtype": "text",
    #     "text": {
    #         "content": "我就是我, 是不一样的烟火"
    #     },
    #     "at": {
    #         "atMobiles": [
    #             "156xxxx8827",
    #             "189xxxx8325"
    #         ],
    #         "isAtAll": false
    #     }
    # }
    class Text < Base
      attr_accessor :content, :at_mobiles, :is_at_all

      def initialize(content='', at_mobiles=[], is_at_all=false)
        @content = content
        @at_mobiles = at_mobiles
        @is_at_all = is_at_all
      end

      def msg_type
        TYPE::TEXT
      end

      def body_params
        super.merge({
                        text: {
                            "content": @content
                        },
                        at: {
                            atMobiles: @at_mobiles,
                            isAtAll: @is_at_all
                        }
                    })
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dingbot-0.1.1 lib/dingbot/message/text.rb
dingbot-0.1.0 lib/dingbot/message/text.rb