Class: Daneel::Script

Inherits:
Plugin
  • Object
show all
Defined in:
lib/daneel/script.rb

Instance Attribute Summary

Attributes inherited from Plugin

#robot

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Plugin

#initialize, #logger, requires_env

Constructor Details

This class inherits a constructor from Daneel::Plugin

Class Method Details

.filesObject



30
31
32
# File 'lib/daneel/script.rb', line 30

def files
  Dir[File.expand_path("../scripts/*.rb", __FILE__)]
end

.inherited(subclass) ⇒ Object



26
27
28
# File 'lib/daneel/script.rb', line 26

def inherited(subclass)
  list << subclass
end

.listObject



22
23
24
# File 'lib/daneel/script.rb', line 22

def list
  @list ||= []
end

Instance Method Details

#accepts?(room, message, user) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/daneel/script.rb', line 6

def accepts?(room, message, user)
  true unless user.id == robot.user.id
end

#helpObject



14
15
16
17
# File 'lib/daneel/script.rb', line 14

def help
  # return a hash of commands and descriptions for help listings
  {}
end

#receive(room, message, user) ⇒ Object



10
11
12
# File 'lib/daneel/script.rb', line 10

def receive(room, message, user)
  # do stuff here!
end