diamondburned / dissent

Tiny native Discord app
https://flathub.org/apps/details/so.libdb.dissent
GNU General Public License v3.0
1.17k stars 38 forks source link

[Enhancement] Polls #257

Open gaussandhisgun opened 3 months ago

gaussandhisgun commented 3 months ago

Discord has added polls into their app. So far they are only available on specific servers (such as Exyl's one ) and barely work on mobile, but i am fairly certain this will be a big deal in the near future.

This is what it looks like:

изображение

and this is what it looks like on Dissent (so far):

изображение

Here's a json of a message containing a poll:

{
    "activity": null,
    "activityInstance": null,
    "application": null,
    "applicationId": null,
    "attachments": [],
    "author": {
        "...": usual author stuff goes here
    },
    "blocked": false,
    "bot": false,
    "call": null,
    "channel_id": "661411243294195740",
    "codedLinks": [],
    "components": [],
    "content": "",
    "editedTimestamp": null,
    "embeds": [],
    "flags": 0,
    "giftCodes": [],
    "id": "1221026979025911810",
    "interaction": null,
    "interactionData": null,
    "interactionError": null,
    "interactionMetadata": null,
    "isSearchHit": false,
    "loggingName": null,
    "mentionChannels": [],
    "mentioned": false,
    "mentionEveryone": false,
    "mentionRoles": [],
    "mentions": [],
    "messageReference": null,
    "nonce": null,
    "pinned": false,
    "poll": {
        "question": {
            "text": "are you cute"
        },
        "answers": [
            {
                "answer_id": 1,
                "poll_media": {
                    "text": "im cute",
                    "emoji": {
                        "id": "875378845832847380",
                        "name": "AdminChanPlead"
                    }
                }
            },
            {
                "answer_id": 2,
                "poll_media": {
                    "text": "im not cute",
                    "emoji": {
                        "id": null,
                        "name": "🤷🏻"
                    }
                }
            }
        ],
        "expiry": "2024-03-24T09:25:17.421Z",
        "allow_multiselect": false,
        "layout_type": 1,
        "results": {
            "answer_counts": [
                {
                    "id": 1,
                    "count": 2,
                    "me_voted": true
                }
            ],
            "is_finalized": false
        }
    },
    "reactions": [
        {
            "count_details": {
                "vote": 2
            },
            "me_vote": true,
            "emoji": {
                "id": "1",
                "name": "",
                "animated": false
            },
            "me": false,
            "me_burst": false,
            "count": 0,
            "burst_count": 0
        }
    ],
    "referralTrialOfferId": null,
    "state": "SENT",
    "stickerItems": [],
    "stickers": [],
    "timestamp": "2024-03-23T09:25:17.384Z",
    "tts": false,
    "type": 0,
    "webhookId": null
}

grabbed with Vencord.

It has a new "poll": {…} field that does not appear in messages that do not have a poll.

Hope this will be helpful in one way or another!