Skip to content

hide other votes from inline_buttons #2

Description

@clipklop

Hi, Aline!

First, it's not an issue by any means, but a request to help or add a feature is possible

And really I want to thank you for your solution of telegram poll bot. It's quite awesome and I really like it. Though, it took me some time to understand how it works :)

So, I've forked your pollbot and worked through it to customize it by my needs. In short, I've just used one type of poll - multiple_options and hardcoded a list of items for polling, removed text message with polling results and putted it to a /cancellation command when I assume that polling is over and I could get a final results of it.

Now, if you share the polling to a group chat where people could vote for an items you'll immediately see how many votes one or another items has votes, but what if don't want to show number of votes in inline_keyboards in group chat and only get results in db and after my /cancellation command. Therefore people in chat wouldn't get a clue how many votes one or another items has votes.
So I played with options function in multiple_options_poll_handler.py and removed votes variable from button, like so:
`
def options(poll):
...
buttons = []

for opt in poll['options']:
    votes = num_votes_on_option(poll, opt['index'])
    buttons.append([{
        'text': "{} {}".format(opt['text'], "✅" if votes > 0 else "",),
        'callback_data': {'i': opt['index']}
    }])
return buttons

`
Now of course members of group chat wouldn't see number of votes in inline buttons, but they could see a green mark in one of the item that other group member voted for. So, question here - how to hide others people votes from inline buttons from everyone in a chat and only mark buttons uniquely for each person?
Let's say you voted for 1, 3 items and you see a green mark only for your votes, but I myself voted for 2 and 4 and only could see my votes respectively.
Do you have any clues how to make it happen? I would really appreciate if you could help with this.

Thanks!

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