Class: Cinch::Plugins::Dice

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/cinch/plugins/dice.rb

Instance Method Summary collapse

Instance Method Details

#execute(m, s) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cinch/plugins/dice.rb', line 13

def execute(m, s)
  return unless Boneroller.is_valid?(s)

  turn = Boneroller::Dice.new(s)
  turn.roll
  m.reply turn.to_s(true)

rescue Boneroller::Errors::RollTooHighError => e
  m.reply "I don't have enough dice to roll that! Try something that is <= #{Boneroller::Dice::HIGH_ROLL_THRESHOLD}."
rescue Boneroller::Errors::RollTooLowError => e
  m.reply "#{m.user.nick} is shooting the wind!"
end