moonbot 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/MoonBot/parser.rb +5 -5
- data/lib/MoonBot/version.rb +1 -1
- metadata +1 -1
data/lib/MoonBot/parser.rb
CHANGED
@@ -3,7 +3,11 @@ module MoonBot
|
|
3
3
|
def self.parse data
|
4
4
|
message = {}
|
5
5
|
# if not empty
|
6
|
-
if data.scan(/^:/)
|
6
|
+
if data.scan(/^:/).empty?
|
7
|
+
body = data.split ' '
|
8
|
+
message[:command] = body.shift
|
9
|
+
message[:args] = body
|
10
|
+
else
|
7
11
|
separated = data.split ':'
|
8
12
|
body = separated[1].split ' '
|
9
13
|
message[:prefix] = body.shift
|
@@ -11,10 +15,6 @@ module MoonBot
|
|
11
15
|
message[:params] = body.shift
|
12
16
|
2.times { separated.shift }
|
13
17
|
message[:trailing] = separated.join(":")
|
14
|
-
else
|
15
|
-
body = data.split ' '
|
16
|
-
message[:command] = body.shift
|
17
|
-
message[:args] = body
|
18
18
|
end
|
19
19
|
message
|
20
20
|
rescue
|
data/lib/MoonBot/version.rb
CHANGED