Hi I am creating a voting system with the nighbot I want when users put messages "1" in youtube chat I need to count that and make percent and show to API that percent number
I want to put 3 options when user put "1" in chat make percent 0 - 100% if user put "2" make percent 0 - 100% and also when user put message "3" make 0 - 100% and I want to show in my stream that numbers from API?
It is only one vote example "3" only show 100% to that 3 option and for "1" "2" put 0% Is that Possible?
15 replies
Gerhard
Hiya, I dont really know what you are trying to make, however have a look at $(urlfetch) or $(eval), you can create your own scripts and calculate the right percentages.
I want to make a script like this website: poll.ma.pe but for youtube poll
Polar Cat
Hey @Loopy Dog!
It was hard to understand, but I think I get what you want.
First of all, let me redirect you towards a solution that is already existing with Nightbot: https://docs.nightbot.tv/commands/poll I would personally recommend this solution.
Now if you want something custom, keep reading. Have you read the first link I sent before? Please do.
This solution isn't 100% accurate as not every vote entry will be taken in account because of Nightbot's cooldown.
One way you could do this is by using the quote system API. You'll get your TOKENS by clicking on the second link in the post, use these in the commands I wrote. To know where to look for your PUBLIC_TOKEN and PRIVATE_TOKEN, look at the field bellow:
Keep your PRIVATE_TOKEN secret, don’t share it anywhere. To add a command containing your PRIVATE_TOKEN do it from the dashboard. Don’t use the chat as anyone could monitor it and copy the token, they could then edit your data.
Thank you for replay! I am making Match Voting System.
Maybe can this work, i have some questions 1. If is possible to I want to instead of run command "!pollresults" is possible to maybe make a realtime update results, that i dont need to run command !pollresults every time because i want to all my stream have results realtime is that possible? 2. How much is nightbot countdown?
Polar Cat
You can add !pollresults as an alias to 1, 2, and 3 for an update in "real time", well every 5 seconds, since it's Nightbot's cooldown, which also means you'll record 1 vote every 5 seconds, and it'll just pollute your chat. That's the reason why I'm heavily recommending the first solution instead of this one, plus you'll be able to display the results in true real time by capturing the browser tab with the poll results.
Loopy Dog
Yes i know that is better option for first one but a lot of people want to type only 1,2,3 in chat, and a lot of users dont understood that need to type command with !, for me second option is easy for users
I have one more question 1. Is possible to add some space between numbers in paste-bin? Have i need only put blank space or need some code in it to make space?
Polar Cat
With the first option the users would just need to click on the link and vote there, there's nothing simpler than that.
And to answer your question, yes it is, but in our case here it's just code, so it's pointless.
Loopy Dog
One more question i trying to find PUBLIC_TOKEN and PRIVATE_TOKEN I dont know do i need to create application app and get that public Client id secret Client id? Is that PUBLIC_TOKEN and PRIVATE_TOKEN
Polar Cat
Read my first answer, I've explained everything. If you can't figure it out, use the first option, which is better in my opinion anyway, it's easy to click on a link, your viewers aren't dumb.
Loopy Dog
Thank you for help I see now link for tokens, if this not work well for me I will switch to your first option Anyway, Thank you again for very big help!! :grinning: :grinning:
Polar Cat
Anytime, have fun with it!
Loopy Dog
Sorry i have one more question i am now looking this code on pastebin, the bot only read that command on pastebin and post back to youtube chat results? But i dont know is possible to post result not in youtube chat i need on specific website to post results from 1,2,3? because i want to post result in my stream not in chat?
Polar Cat
With this option, the results can only be displayed in the chat.
If you want to display the results in your stream use the first option, as I said before, you can capture the browser tab with the poll results this way.
Loopy Dog
I see i will use first option anyway, thank you for help
Didn't find your answer? The community is on Discord.