From 7f134adccb20abe773234acecf526c9951b418e8 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 20 Apr 2014 04:23:20 -0700 Subject: Improved namespace and directory structure. --- module/module.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 module/module.rb (limited to 'module/module.rb') 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 -- cgit v1.2.3-70-g09d2