aboutsummaryrefslogtreecommitdiff
path: root/module/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'module/base.rb')
-rw-r--r--module/base.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/module/base.rb b/module/base.rb
new file mode 100644
index 0000000..b8be306
--- /dev/null
+++ b/module/base.rb
@@ -0,0 +1,25 @@
+module Dinobot
+ module Module
+ class Base
+ 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