Class: Ruboty::Actions::Ragoon::Notification

Inherits:
Base
  • Object
show all
Includes:
Ruboty::Actions::Ragoon
Defined in:
lib/ruboty/actions/ragoon/notification.rb

Instance Method Summary collapse

Methods included from Ruboty::Actions::Ragoon

#private?

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ruboty/actions/ragoon/notification.rb', line 5

def call
  notifications = ::Ruboty::Ragoon::Notification.new(message.robot.brain)

  notifications.retrieve
  unless notifications.empty?
    reply = [":new: #{notifications.unread_count}件の新着通知があります #{notifications.list_url}"]

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

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