Skip to content

Anonymous Poll with Live Count - Send PMs #84

@boonebytes

Description

@boonebytes

Would like to suggest a feature, with proposed code changes.

When running an anonymous poll with the live counts, our members do not receive a confirmation that their vote was added. When there are multiple people voting, this could cause some confusion as to if a vote is counted or not. Sure, users could use the reaction to get a PM of their current vote, but not many of our users are aware of this.

I'd like to suggest sending a PM when the vote is received, if the poll is anonymous OR live counting is disabled... as opposed to the current AND condition.

I'd also like to suggest sending a PM when someone unvotes.

Here's a snapshot of the related lines of code that could be changed to accomplish this:

diff --git a/models/poll.py b/models/poll.py
index 7cb01a2..15561ac 100644
--- a/models/poll.py
+++ b/models/poll.py
@@ -1487,6 +1487,7 @@ class Poll:
             if vote:
                 await vote.delete_from_db()
                 await self.refresh(message)
+                await self.bot.loop.create_task(user.send(f'Your vote for **{self.options_reaction[choice]}** has been REMOVED.'))
                 return
 
         # check if already voted for the same choice
@@ -1524,7 +1525,7 @@ class Poll:
             if not answer or answer.lower() == "-":
                 answer = "No Answer"
 
-        if self.anonymous and self.hide_count:
+        if self.anonymous or self.hide_count:
             self.bot.loop.create_task(user.send(f'Your vote for **{self.options_reaction[choice]}** has been counted.'))
 
         # commit

I'm not a Python programmer... but hopefully this demonstrates my suggestion well.

Thanks for all your help with the Pollmaster! Much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions