rubot 0.1.1 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/rubot CHANGED
File without changes
@@ -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
- if message.body =~ /^#{@function_character}([a-z_]+)( .+)?$/i
71
- message.body = $2.nil? ? "" : $2.strip # remove the function name from the message
72
- message.alias = $1.underscore.to_sym
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
- command = command_from_message(message)
75
- command.run(server, message) unless command.nil?
76
- elsif message.from != server.nick
77
- @listeners.each_value do |listener|
78
- listener.execute(server, message)
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
@@ -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 Paraters
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"
@@ -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
- @message_queue.message(destination, message)
101
- # TODO use build_message_array with the queue
102
- #message = message.to_s.split("\n") unless message.is_a? Array
103
- #build_message_array(message).each do |l|
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
- - 1
9
- version: 0.1.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-07 00:00:00 -08:00
17
+ date: 2010-04-10 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies: []
20
20