Sha256: 44c60067c869d09a59e6a0bbc277d2744daac00c3ba2bb296bd7a014ace3a0ac

Contents?: true

Size: 666 Bytes

Versions: 2

Compression:

Stored size: 666 Bytes

Contents

module Ruboty
  module Actions
    class Notification < ::Ruboty::Actions::Base
      include ::Ruboty::Actions::Helpers

      def call
        notifications = ::Ruboty::Ragoon::Notification.new
        unless notifications.empty?
          reply = [":new: #{notifications.unread_count}件の新着通知があります #{notification_url}"]

          if private?
            reply += notifications.list.find_all(&:unread).map(&:format)
          end

          message.reply(reply.join("\n"))
        end
      end

      private

      def notification_url
        "#{::Ragoon::garoon_endpoint.gsub(/\?.*\Z/, '')}/notification/index"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruboty-ragoon-0.3.1 lib/ruboty/actions/notification.rb
ruboty-ragoon-0.3.0 lib/ruboty/actions/notification.rb