aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dinobot.rb6
-rw-r--r--module.rb2
2 files changed, 6 insertions, 2 deletions
diff --git a/dinobot.rb b/dinobot.rb
index 690a384..57f980c 100644
--- a/dinobot.rb
+++ b/dinobot.rb
@@ -78,7 +78,11 @@ module Dinobot
def parse_command(user, channel, command, prev=nil)
command, remainder = command.split(' | ', 2)
- mod = command.scan(/\A\S+/).first.downcase.intern
+ mod = command.scan(/\A\S+/).first.downcase
+
+ return unless @modules.keys.map { |x| x.to_s }.include?(mod)
+
+ mod = mod.intern
if prev.nil?
methods = @modules[mod].call(user, channel, command)
diff --git a/module.rb b/module.rb
index 192aea4..082fc83 100644
--- a/module.rb
+++ b/module.rb
@@ -11,7 +11,7 @@ module Dinobot
def call(user, channel, message)
command, argument = message.split(' ', 3)[1..2]
- if @commands.include?(command.intern)
+ if @commands.map { |x| x.to_s }.include?(command)
send(command, user, channel, argument)
end
end