jabber-bot 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/HISTORY +9 -0
  2. data/README +4 -4
  3. data/lib/jabber/bot.rb +4 -5
  4. metadata +4 -2
data/HISTORY ADDED
@@ -0,0 +1,9 @@
1
+ Jabber::Bot Release History
2
+
3
+ Version 1.0.1 (21 March 2007)
4
+ * Fix debug puts remnant in parse_command.
5
+ * Fix message.sub regex during command callback in parse_command.
6
+ * Fix default '?' alias command regex.
7
+
8
+ Version 1.0.0 (20 March 2007)
9
+ * Initial release.
data/README CHANGED
@@ -8,7 +8,7 @@ bot's repertoire, you and your new bot will be able to accomplish nearly
8
8
  anything.
9
9
 
10
10
  Author:: Brett Stimmerman (mailto:brettstimmerman@gmail.com)
11
- Version:: 1.0.0
11
+ Version:: 1.0.1
12
12
  Copyright:: Copyright (c) 2007 Brett Stimmerman. All rights reserved.
13
13
  License:: New BSD License (http://opensource.org/licenses/bsd-license.php)
14
14
  Website:: http://socket7.net/software/jabber-bot
@@ -31,18 +31,18 @@ Website:: http://socket7.net/software/jabber-bot
31
31
 
32
32
  # Give your bot a private command, 'rand'
33
33
  bot.add_command(
34
- :syntax => 'rand',
34
+ :syntax => 'rand',
35
35
  :description => 'Produce a random number from 0 to 10',
36
36
  :regex => /^rand$/
37
37
  ) { rand(10).to_s }
38
38
 
39
39
  # Give your bot a public command, 'puts <string>' with an alias 'p <string>'
40
40
  bot.add_command(
41
- :syntax => 'puts <string>',
41
+ :syntax => 'puts <string>',
42
42
  :description => 'Write something to $stdout',
43
43
  :regex => /^puts\s+.+$/,
44
44
  :aliases => [ :alias => 'p <string>', :regex => /^p\s+.+$/ ],
45
- :is_public => true
45
+ :is_public => true
46
46
  ) do |message|
47
47
  puts message
48
48
  "'#{message}' written to $stdout"
@@ -38,7 +38,7 @@ module Jabber
38
38
  # repertoire, you and your new bot will be able to accomplish nearly anything.
39
39
  #
40
40
  # Author:: Brett Stimmerman (mailto:brettstimmerman@gmail.com)
41
- # Version:: 0.1.0
41
+ # Version:: 1.0.1
42
42
  # Copyright:: Copyright (c) 2007 Brett Stimmerman. All rights reserved.
43
43
  # License:: New BSD License (http://opensource.org/licenses/bsd-license.php)
44
44
  # Website:: http://socket7.net/software/jabber-bot
@@ -104,7 +104,7 @@ module Jabber
104
104
  :syntax => 'help',
105
105
  :description => 'Display this help message',
106
106
  :regex => /^help$/,
107
- :alias => [ :syntax => '?', :regex => /^\?/ ],
107
+ :alias => [ :syntax => '?', :regex => /^\?$/ ],
108
108
  :is_public => @bot_config[:is_public]
109
109
  ) { |sender, message| help_message(sender) }
110
110
  end
@@ -256,7 +256,6 @@ module Jabber
256
256
  # If the bot has not been made public, commands from anyone other than the
257
257
  # bot master(s) will be silently ignored.
258
258
  def parse_command(sender, message) #:nodoc:
259
- puts sender + " " + message
260
259
  is_master = @bot_config[:master].include?(sender)
261
260
 
262
261
  if @bot_config[:is_public] or is_master
@@ -265,7 +264,7 @@ module Jabber
265
264
  if command[:is_public] or is_master
266
265
  unless (message.strip =~ command[:regex]).nil?
267
266
  response = command[:callback].call(sender,
268
- message.sub(/.+\s+/, ''))
267
+ message.sub(/^.[^\s]+\s+/, ''))
269
268
 
270
269
  deliver(sender, response) unless response.nil?
271
270
  return
@@ -274,7 +273,7 @@ module Jabber
274
273
  end
275
274
 
276
275
  response = "I don't understand '#{message.strip}.' Try saying 'help' " +
277
- "to see what commands I understand"
276
+ "to see what commands I understand."
278
277
  deliver(sender, response)
279
278
 
280
279
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: jabber-bot
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2007-03-20 00:00:00 -07:00
6
+ version: 1.0.1
7
+ date: 2007-03-22 00:00:00 -07:00
8
8
  summary: Jabber::Bot makes it simple to create and command your own Jabber bot with little fuss. By adding custom commands powered by regular expressions to your bot's repertoire, you and your new bot will be able to accomplish nearly anything.
9
9
  require_paths:
10
10
  - lib
@@ -33,6 +33,7 @@ files:
33
33
  - lib/jabber/bot.rb
34
34
  - LICENSE
35
35
  - README
36
+ - HISTORY
36
37
  test_files: []
37
38
 
38
39
  rdoc_options:
@@ -44,6 +45,7 @@ rdoc_options:
44
45
  extra_rdoc_files:
45
46
  - README
46
47
  - LICENSE
48
+ - HISTORY
47
49
  executables: []
48
50
 
49
51
  extensions: []