rubot 0.1.1 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/rubot +0 -0
- data/lib/core/dispatcher.rb +11 -9
- data/lib/irc/message_queue.rb +1 -1
- data/lib/irc/server.rb +4 -6
- metadata +3 -3
data/bin/rubot
CHANGED
File without changes
|
data/lib/core/dispatcher.rb
CHANGED
@@ -66,16 +66,18 @@ module Rubot
|
|
66
66
|
# ==== Parameters
|
67
67
|
# server<Rubot::Irc::Server>:: The server where the messge was received
|
68
68
|
# message<Rubot:Irc::Message>:: The message to handle
|
69
|
-
def handle_message(server, message)
|
70
|
-
|
71
|
-
message.body
|
72
|
-
|
69
|
+
def handle_message(server, message)
|
70
|
+
Thread.new do
|
71
|
+
if message.body.start_with?(@function_character) && message.body =~ /^.([a-z_]+)( .+)?$/i
|
72
|
+
message.body = $2.nil? ? "" : $2.strip # remove the function name from the message
|
73
|
+
message.alias = $1.underscore.to_sym
|
73
74
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
command = command_from_message(message)
|
76
|
+
command.run(server, message) unless command.nil?
|
77
|
+
elsif message.from != server.nick
|
78
|
+
@listeners.each_value do |listener|
|
79
|
+
listener.execute(server, message)
|
80
|
+
end
|
79
81
|
end
|
80
82
|
end
|
81
83
|
end
|
data/lib/irc/message_queue.rb
CHANGED
@@ -45,7 +45,7 @@ module Rubot
|
|
45
45
|
# In the case of (exploded) arrays, each element in the array will be treated
|
46
46
|
# as a separate call to the block used to create the method.
|
47
47
|
#
|
48
|
-
# ==== Fancy Pants
|
48
|
+
# ==== Fancy Pants Parameters
|
49
49
|
# Assuming the code above has been executed, we can run the following:
|
50
50
|
#
|
51
51
|
# @message_queue.message "destination_three", "message one", "message two", "message three"
|
data/lib/irc/server.rb
CHANGED
@@ -97,12 +97,10 @@ module Rubot
|
|
97
97
|
# destination<String>:: Where to send the message
|
98
98
|
# message<String,Array>:: The message(s) to be sent
|
99
99
|
def msg(destination, message)
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
# raw "PRIVMSG #{destination} :#{l}"
|
105
|
-
#end
|
100
|
+
message = message.to_s.split("\n") unless message.is_a? Array
|
101
|
+
build_message_array(message).each do |line|
|
102
|
+
@message_queue.message(destination, line)
|
103
|
+
end
|
106
104
|
end
|
107
105
|
|
108
106
|
# Adds action(s) to the outgoing queue
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 5
|
9
|
+
version: 0.1.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Chris Thorn
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-10 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|