add confirmation DM for (un)voting with anon and hidden votes

This commit is contained in:
Matthias Nadler 2019-07-16 01:36:52 +02:00
parent 7d1221c783
commit 459b7a4c5c

View File

@ -1431,6 +1431,7 @@ class Poll:
embed.set_author(name='Pollmaster', icon_url=SETTINGS.author_icon) embed.set_author(name='Pollmaster', icon_url=SETTINGS.author_icon)
await user.send(embed=embed) await user.send(embed=embed)
# refresh_poll = False # refresh_poll = False
return
else: else:
if choice in self.survey_flags: if choice in self.survey_flags:
if len(self.votes[str(user.id)]['answers']) != len(self.survey_flags): if len(self.votes[str(user.id)]['answers']) != len(self.survey_flags):
@ -1448,6 +1449,8 @@ class Poll:
self.votes[str(user.id)]['choices'].append(choice) self.votes[str(user.id)]['choices'].append(choice)
self.votes[str(user.id)]['choices'] = list(set(self.votes[str(user.id)]['choices'])) self.votes[str(user.id)]['choices'] = list(set(self.votes[str(user.id)]['choices']))
if self.anonymous and self.hide_count:
await user.send(f'Your vote for **{self.options_reaction[choice]}** has been counted.')
# else: # else:
# if [choice] == self.votes[user.id]['choices']: # if [choice] == self.votes[user.id]['choices']:
# # refresh_poll = False # # refresh_poll = False
@ -1497,6 +1500,8 @@ class Poll:
await self.save_to_db() await self.save_to_db()
if not self.hide_count: if not self.hide_count:
asyncio.ensure_future(message.edit(embed=await self.generate_embed())) asyncio.ensure_future(message.edit(embed=await self.generate_embed()))
elif self.anonymous:
await user.send(f'Your vote for **{self.options_reaction[choice]}** has been removed.')
except ValueError: except ValueError:
pass pass