mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-22 16:35:52 -05:00
🆙 Poll Update
This commit is contained in:
parent
4b47572856
commit
00dc874f59
19
41.md
19
41.md
|
@ -16,11 +16,10 @@ tag: poll
|
||||||
options:
|
options:
|
||||||
- <multi|single> allow others to reply with one or multiple options
|
- <multi|single> allow others to reply with one or multiple options
|
||||||
- <ttl> TTL (in seconds|timestamp) when surv expires, 0 TTL don't expire
|
- <ttl> TTL (in seconds|timestamp) when surv expires, 0 TTL don't expire
|
||||||
|
- <title> optional poll name ("" if not present)
|
||||||
- [<option>]: array of string
|
- [<option>]: array of string
|
||||||
```
|
```
|
||||||
|
|
||||||
And you can also add a `poll_name` tag to add a title to the poll, but it's optional.
|
|
||||||
|
|
||||||
#### Example - Message
|
#### Example - Message
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
@ -29,8 +28,7 @@ And you can also add a `poll_name` tag to add a title to the poll, but it's opti
|
||||||
"kind": 1,
|
"kind": 1,
|
||||||
"tags": [
|
"tags": [
|
||||||
...
|
...
|
||||||
["poll", "Option 1", "Option 2", "Option 3"],
|
["poll", "single", "0", "I'm a title!", "Option 1", "Option 2", "Option 3"],
|
||||||
["poll_name", "This is optional"]
|
|
||||||
...
|
...
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
@ -43,7 +41,10 @@ The format of the event is the following:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
kind: 9
|
kind: 9
|
||||||
content: <choice, which is the index of the option | the first option is 0>
|
content: <reason for voting> // Can be empty string
|
||||||
|
tag: poll_r // for poll response
|
||||||
|
options:
|
||||||
|
- [<choices>]: array of index of the option | the first option is 0
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Example - Vote
|
#### Example - Vote
|
||||||
|
@ -54,10 +55,13 @@ content: <choice, which is the index of the option | the first option is 0>
|
||||||
"kind": 9,
|
"kind": 9,
|
||||||
"tags": [
|
"tags": [
|
||||||
...
|
...
|
||||||
["e", "<event-id>"]
|
["e", "<event-id>"],
|
||||||
|
["poll_r", "0"],
|
||||||
|
// OR
|
||||||
|
["poll_r", "0", "2"]
|
||||||
...
|
...
|
||||||
],
|
],
|
||||||
"content": "1"
|
"content": "reason for voting"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -68,6 +72,7 @@ content: <choice, which is the index of the option | the first option is 0>
|
||||||
- Clients should display poll options if more than **one option** is present in the poll
|
- Clients should display poll options if more than **one option** is present in the poll
|
||||||
- Clients should ignore vote events if the poll is **expired**
|
- Clients should ignore vote events if the poll is **expired**
|
||||||
- Clients should not display more than one poll per message. The first poll in the message should be displayed.
|
- Clients should not display more than one poll per message. The first poll in the message should be displayed.
|
||||||
|
- Poll title should be displayed if present and should be limited to 25 chars
|
||||||
|
|
||||||
## Warning
|
## Warning
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user