- attr_reader :trigger, :reply
- attr_reader :raw_trigger, :raw_reply
- attr_accessor :author, :date, :channel
+ attr_reader :trigger, :replies
+ attr_reader :raw_trigger, :raw_replies
+
+ class ::Reply
+ attr_reader :act, :reply, :pct, :range
+ attr_reader :author, :date, :channel
+ attr_writer :date
+
+ def pct=(val)
+ @pct = val
+ @reaction.make_ranges
+ end
+
+ def author=(name)
+ @author = name.to_s
+ end
+
+ def channel=(name)
+ @channel = name.to_s
+ end
+
+ def initialize(reaction, act, expr, pct, author, date, channel)
+ @reaction = reaction
+ @act = act
+ @reply = expr
+ self.pct = pct
+ self.author = author
+ @date = date
+ self.channel = channel
+ end
+
+ def to_s
+ [
+ "#{act} #{reply} (#{pct} chance)",
+ @range ? "(#{@range})" : "",
+ "(#{author}, #{channel}, #{date})"
+ ].join(" ")
+ end
+
+ def apply(subs={})
+ [act, reply % subs]
+ end
+ end