summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2012-09-21 14:55:42 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2012-09-21 14:56:15 +0200
commitd1c6075f5ee38ff6edbca8545f65be3c2516ebf2 (patch)
tree030e368a58113644b8b651b9559ea7a352372a28 /data/rbot
parent3fba86655eaf3fefd4068360234a42e34a013388 (diff)
poll: handle privately-asked polls
When a poll is asked in private, its channel will be empty. Make sure that communication go in private again, and do mention that the poll was asked in private in the poll info.
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/poll.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/data/rbot/plugins/poll.rb b/data/rbot/plugins/poll.rb
index 4dc28e69..0b91d27d 100644
--- a/data/rbot/plugins/poll.rb
+++ b/data/rbot/plugins/poll.rb
@@ -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]
@@ -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)