]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
* (plugins) changed to the new reply schema (:nick)
authorSimon Hafner <hafnersimon@gmail.com>
Wed, 21 Jan 2009 15:02:08 +0000 (16:02 +0100)
committerdmitry kim <jason@nichego.net>
Wed, 21 Jan 2009 23:26:24 +0000 (02:26 +0300)
data/rbot/plugins/dice.rb
data/rbot/plugins/games/uno.rb
data/rbot/plugins/games/wheelfortune.rb
data/rbot/plugins/markov.rb
data/rbot/plugins/salut.rb
data/rbot/plugins/url.rb

index 230035ec419acf36b447b0bcb08bf326542d4d58..85e98f36a7c7a8f6cdfc47a8c9a15fce4b7718d1 100644 (file)
@@ -53,7 +53,7 @@ class DicePlugin < Plugin
     dice = d.split(/d/)
     repr = []
     r = 0
-    unless dice[0] =~ /^[0-9]+/
+    unless dice[0] =~ /^\d+/
       dice[0] = 1
     end
     for i in 0...dice[0].to_i
@@ -86,14 +86,14 @@ class DicePlugin < Plugin
   def privmsg(m)
     # If either not given parameters or given incorrect parameters, return with
     # the help message
-    unless(m.params && m.params =~ /^[0-9]*d[0-9]+(\s*[+-]\s*([0-9]+|[0-9]*d[0-9])+)*$/)
-      m.nickreply "incorrect usage: " + help(m.plugin)
+    unless m.params && m.params =~ /^\d*d\d+(\s*[-]\s*(\d+|\d*d\d)+)*$/
+      m.reply "incorrect usage: " + help(m.plugin)
       return
     end
 
     # Extract the actual dice request from the message parameters, splitting it
     # into dice and modifiers
-    a = m.params.gsub(/\s+/,'').scan(/^[0-9]*d[0-9]+|[+-][0-9]*d[0-9]+|[+-][0-9]+/)
+    a = m.params.gsub(/\s+/,'').scan(/^\d*d\d+|[+-]\d*d\d+|[+-]\d+/)
     # check nr of total dices and sides per dice
     nr = 0
     a.each { |dice|
@@ -123,7 +123,7 @@ class DicePlugin < Plugin
       t = t + tmp.get_view
     end
     t.chop!
-    m.nickreply r.to_s + " || " + m.params + ": " + t
+    m.reply(r.to_s + " || " + m.params + ": " + t)
   end
 end
 plugin = DicePlugin.new
index dc8de03e4cf9c0289867bae07a32d0b1134e4000..5b2593ee746212db524e62ca5b5a33cbf4171cb2 100644 (file)
@@ -941,7 +941,7 @@ class UnoPlugin < Plugin
     when :tu # show whose turn is it
       return if m.params
       if g.has_turn?(m.source)
-        m.nickreply _("it's your turn, sleepyhead")
+        m.reply _("it's your turn, sleepyhead"), :nick => true
       else
         g.show_turn(:cards => false)
       end
index 4c1a48f06fc1f58423a6f9ea84badad3a0aa25cb..7e81895378f288dc78703030e86cd6bed9a20031 100644 (file)
@@ -476,9 +476,7 @@ class WheelOfFortune < Plugin
       # m.reply "STUPID! YOU SO STUPID!"
       return
     when *game.must_buy
-      m.nickreply _("You must buy the %{vowel}") % {
-        :vowel => check
-      }
+      m.reply _("You must buy the %{vowel}") % {:vowel => check}, :nick => true
     when :wrong
       return
     when Numeric, :missing
index 48be706749d80d5eaf7091fbec3e778165972685..3a1fea59d3613057be8f13545531e4358c7a5fc5 100644 (file)
@@ -187,7 +187,7 @@ class MarkovPlugin < Plugin
     # of the line we received
     return if message.index(line) == 0
     @bot.timer.add_once(delay) {
-      m.plainreply line
+      m.reply line, :nick => false
     }
   end
 
index 569bade48d070a208938e532819248ea5641ea2f..131821a7ac90fb9594612a0f7afc7449194c8798 100644 (file)
@@ -158,7 +158,7 @@ class SalutPlugin < Plugin
       end
     end
     debug "Replying #{choice}"
-    m.plainreply choice
+    m.reply choice, :nick => false
   end
 
   def reload
index 8c4746b5a44f8253d6d12a692b193b9fc543083f..826af10defec3c53b241ff972da73c2404326d06 100644 (file)
@@ -160,7 +160,8 @@ class UrlPlugin < Plugin
 
       if display_info > urls_displayed
         if reply
-          m.plainreply(reply, :overlong => :truncate)
+          m.reply reply, :overlong => :truncate,
+            :nick => (m.address? ? :auto : false)
           urls_displayed += 1
         end
       end