Vic on Nostr: I've hacked together a simplistic poll capability that can be tested by sending ...
I've hacked together a simplistic poll capability that can be tested by sending commands to the account named `Polly (npub14r4…nvkt) Botzzapp`.
If the account is mentioned in a post, then it can create a poll in response to the word "NEWPOLL", followed by the type "CHOICE" or "YESNO". A "CHOICE" poll can have up to 10 answers which should following delimited by pipe symbol. For example "NEWPOLL CHOICE Red|Blue|Purple ..." Following this an optional parameter "EXPIRE" may be given with a value consisting of a number and an abbreviated unit suffix. It recognizes h (hours), d (days), w (weeks), y (years). For example "EXPIRE 3d" would expire the poll in 3 days. Finally all polls must end with a "PROMPT" argument where all content to the end of the content is the prompt for the poll.
An example message would be `NEWPOLL YESNO EXPIRE 1w PROMPT Should Nostr clients allow custom zap amounts?`
Or, in the case of a choice poll: `NEWPOLL CHOICE Ford|Chevrolet|Dodge EXPIRE 5d PROMPT Who makes the best pickup truck?`
The poll is initiated as a response post to your message.
Answers/Votes can be given by zapping the poll that Polly (npub14r4…nvkt) makes with a value corresponding to the answer (instructions are given in the image). For a YESNO type poll, zaps are counted based on whether the amount is even (counts as a yes vote) or odd (counts as a no vote).
Different clients cache images in different ways, so you may need to do a hard refresh in web browsers to see the latest image update, or clear cache in mobile apps.
If the account is mentioned in a post, then it can create a poll in response to the word "NEWPOLL", followed by the type "CHOICE" or "YESNO". A "CHOICE" poll can have up to 10 answers which should following delimited by pipe symbol. For example "NEWPOLL CHOICE Red|Blue|Purple ..." Following this an optional parameter "EXPIRE" may be given with a value consisting of a number and an abbreviated unit suffix. It recognizes h (hours), d (days), w (weeks), y (years). For example "EXPIRE 3d" would expire the poll in 3 days. Finally all polls must end with a "PROMPT" argument where all content to the end of the content is the prompt for the poll.
An example message would be `NEWPOLL YESNO EXPIRE 1w PROMPT Should Nostr clients allow custom zap amounts?`
Or, in the case of a choice poll: `NEWPOLL CHOICE Ford|Chevrolet|Dodge EXPIRE 5d PROMPT Who makes the best pickup truck?`
The poll is initiated as a response post to your message.
Answers/Votes can be given by zapping the poll that Polly (npub14r4…nvkt) makes with a value corresponding to the answer (instructions are given in the image). For a YESNO type poll, zaps are counted based on whether the amount is even (counts as a yes vote) or odd (counts as a no vote).
Different clients cache images in different ways, so you may need to do a hard refresh in web browsers to see the latest image update, or clear cache in mobile apps.