aboutsummaryrefslogtreecommitdiff
path: root/module/module.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-04-20 04:23:20 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-04-20 04:23:20 -0700
commit7f134adccb20abe773234acecf526c9951b418e8 (patch)
treeeeb4b4f96a963591f244c8f661b84dd194cf1484 /module/module.rb
parent7e7aa3278a9e478b02eb152575fb00ee0802ac81 (diff)
downloaddinobot-7f134adccb20abe773234acecf526c9951b418e8.tar.gz
dinobot-7f134adccb20abe773234acecf526c9951b418e8.tar.xz
Improved namespace and directory structure.
Diffstat (limited to 'module/module.rb')
-rw-r--r--module/module.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/module/module.rb b/module/module.rb
new file mode 100644
index 0000000..9d72b09
--- /dev/null
+++ b/module/module.rb
@@ -0,0 +1,25 @@
+module Dinobot
+ module Module
+ class Module
+ attr_accessor :commands
+
+ def initialize(bot)
+ @bot = bot
+
+ @commands = [:commands]
+ end
+
+ def call(user, channel, message)
+ command, argument = message.split(' ', 3)[1..2]
+
+ if @commands.map { |x| x.to_s }.include?(command)
+ send(command, user, channel, argument)
+ end
+ end
+
+ def commands(user, channel, argument)
+ [[:say, channel, "Commands: #{@commands.sort.join(' ')}"]]
+ end
+ end
+ end
+end