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
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|
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
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
# 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
# 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
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