]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/poll.rb
plugin(points): new message parser, see #34
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / poll.rb
index 4dc28e69be77f075b5792d3a651ccf4ccedd2cac..45744b197b86438f4908d4ca6e0c29686b06e4cf 100644 (file)
@@ -236,7 +236,9 @@ class PollPlugin < Plugin
     return if poll == nil
     poll.stop!
 
-    @bot.say(poll.channel, _("let's find the answer to: %{q}") % {
+    dest = poll.channel ? poll.channel : poll.author
+
+    @bot.say(dest, _("let's find the answer to: %{q}") % {
       :q => "#{Bold}#{poll.question}#{Bold}"
     })
 
@@ -268,7 +270,7 @@ class PollPlugin < Plugin
       end
     end
 
-    @bot.say poll.channel, poll.outcome
+    @bot.say dest, poll.outcome
 
     # Now that we're done, move it to the archives
     archives = @registry[:archives]
@@ -325,7 +327,7 @@ class PollPlugin < Plugin
       return
     end
 
-    to_reply = _("poll #%{id} was asked by %{bold}%{author}%{bold} in %{bold}%{channel}%{bold} %{started}.")
+    to_reply = _("poll #%{id} was asked by %{bold}%{author}%{bold} in %{bold}%{channel}%{bold} %{started}.").dup
     options = ''
     outcome = ''
     if poll.running
@@ -342,7 +344,8 @@ class PollPlugin < Plugin
 
     m.reply((to_reply % {
       :bold => Bold,
-      :id => poll.id, :author => poll.author, :channel => poll.channel,
+      :id => poll.id, :author => poll.author,
+      :channel => (poll.channel ? poll.channel : _("private")),
       :started => poll.started,
       :end => poll.ends_at
     }) + options + outcome)