]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/dice.rb
webhook: gitlab support
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / dice.rb
index 85e98f36a7c7a8f6cdfc47a8c9a15fce4b7718d1..7e0662b1d0f42a3dd5f96660fa51d6eec543f4ee 100644 (file)
@@ -86,7 +86,7 @@ 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 =~ /^\d*d\d+(\s*[-]\s*(\d+|\d*d\d)+)*$/
+    unless m.params && m.params =~ /^\d*d\d+(\s*[+-]\s*(\d+|\d*d\d)+)*$/
       m.reply "incorrect usage: " + help(m.plugin)
       return
     end
@@ -100,14 +100,14 @@ class DicePlugin < Plugin
       dc, ds = dice.split(/d/)
       # check sides
       if ds.to_i > @bot.config['dice.max_sides']
-       m.reply "sorry, don't have any dices with more than %u sides" % @bot.config['dice.max_sides']
+       m.reply "sorry, don't have any dices with more than %u sides" % @bot.config['dice.max_sides'], :nick => true
        return
       end
       # We use .max with 1 so that specs such as d6 count as 1 and not as 0
       nr += [dc.to_i, 1].max
     }
     if nr > @bot.config['dice.max_dices']
-      m.reply "can't handle more than %u dices" % @bot.config['dice.max_dices']
+      m.reply "can't handle more than %u dices" % @bot.config['dice.max_dices'], :nick => true
       return
     end
 
@@ -123,7 +123,7 @@ class DicePlugin < Plugin
       t = t + tmp.get_view
     end
     t.chop!
-    m.reply(r.to_s + " || " + m.params + ": " + t)
+    m.reply(r.to_s + " || " + m.params + ": " + t, :nick => true)
   end
 end
 plugin = DicePlugin.new