]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/poll.rb
quiz: stop quizzes and timers on cleanup
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / poll.rb
index a2cc927456e3b721f799622260fcaabe8e82c919..814b2673ff67390a65dbb346d7475c10734672eb 100644 (file)
@@ -8,6 +8,10 @@
 #
 # Submit a poll question to a channel, wait for glorious outcome.
 #
+# TODO better display for start/end times
+# TODO 'until ...' time spec
+# TODO early poll termination
+# TODO option to inform people about running polls on join (if they haven't voted yet)
 
 class ::Poll
   attr_accessor :id, :author, :channel, :running, :ends_at, :started
@@ -63,6 +67,7 @@ class ::Poll
       @voters[voter] = choice
 
       return _("recorded your vote for %{choice}: %{value}") % {
+        :choice => choice,
         :value => @answers[choice][:value]
       }
     else
@@ -83,7 +88,7 @@ class ::Poll
   end
 
   def options
-    options = _("options are: ")
+    options = _("options are: ").dup
     @answers.each { |letter, info|
       options << "#{Bold}#{letter}#{NormalText}) #{info[:value]} "
     }
@@ -197,7 +202,7 @@ class PollPlugin < Plugin
     command = _("poll vote %{id} <SINGLE-LETTER>") % {
       :id => poll.id
     }
-    instructions = _("you have %{duration}, vote with ")
+    instructions = _("you have %{duration}, vote with ").dup
     instructions << _("%{priv} or %{public}")
     m.reply instructions % {
       :duration => "#{Bold}#{target_duration}#{Bold}",
@@ -323,12 +328,12 @@ class PollPlugin < Plugin
       outcome << " #{poll.outcome}"
     end
 
-    m.reply (to_reply % {
+    m.reply((to_reply % {
       :bold => Bold,
       :id => poll.id, :author => poll.author, :channel => poll.channel,
       :started => poll.started,
       :end => poll.ends_at
-    }) + options + outcome
+    }) + options + outcome)
   end
 
   def help(plugin,topic="")