Try not to explode violently in some weird scenarios

This commit is contained in:
Robert Gerus 2014-03-09 10:53:01 +01:00
parent 4973d83165
commit eac7543bfe

View file

@ -58,12 +58,17 @@ Client.register_trigger("PRIVMSG") { |msg|
command = message.split[1]
arguments = message.split[2..-1]
else
# did the message start with a :?
# If so, use everything after ":" from the first word as a command and
# all the other words as arguments array
if message.split.first[0] == ":" then
command = message.split.first[1..-1]
arguments = message.split[1..-1]
if not message.split.first.nil? then
# did the message start with a :?
# If so, use everything after ":" from the first word as a command and
# all the other words as arguments array
if message.split.first[0] == ":" then
command = message.split.first[1..-1]
arguments = message.split[1..-1]
end
else
command = ""
arguments = ""
end
end