🆙 Poll Update

This commit is contained in:
Thomas 2023-02-28 09:41:01 +01:00
parent 4b47572856
commit 00dc874f59

19
41.md
View File

@ -16,11 +16,10 @@ tag: poll
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
- <title> optional poll name ("" if not present)
- [<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
```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,
"tags": [
...
["poll", "Option 1", "Option 2", "Option 3"],
["poll_name", "This is optional"]
["poll", "single", "0", "I'm a title!", "Option 1", "Option 2", "Option 3"],
...
],
}
@ -43,7 +41,10 @@ The format of the event is the following:
```json
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
@ -54,10 +55,13 @@ content: <choice, which is the index of the option | the first option is 0>
"kind": 9,
"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 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.
- Poll title should be displayed if present and should be limited to 25 chars
## Warning