跳至內容

訊息範本

投票的標頭、頁尾、討論串訊息和結果訊息都是 Liquid 範本。可在 儀表板 → 訊息 中編輯;預覽會隨輸入即時更新。

結果

週五晚上我們要做什麼?
🎮 Minecraft 建築比賽: 49.5%
🍿 電影之夜: 32%
🃏 卡牌遊戲: 18.6%
81 人參與 · 後天

變數

{{ poll.question }}問題
{{ poll.description }}問題下方的附加文字
{{ poll.type }}以投票語言顯示的「投票」或「快速投票」
{{ poll.status }}draft、scheduled、running 或 closed
{{ poll.votes }}全部票數(加權)
{{ poll.voters }}投票的成員數
{{ poll.creator.name / .mention / .id }}投票建立者
{{ poll.createdAt / startsAt / endsAt / closedAt }}Unix 時間戳記,請使用 timestamp 篩選器
{{ poll.closeReason }}投票結束的原因
{{ poll.maxChoices }}成員最多可選的選項數
{{ poll.anonymous / voteChange / weighted / hideResults }}投票選項(true/false)
{{ poll.webUrl / url }}網頁 / Discord 訊息連結
{{ choices }}清單:id, text, emoji, votes, voters, percent, winner
{{ choice.emoji / name / percent / votesText / number / winner }}選項行中:目前選項(emoji、name、percent、votes、votesText、number、winner)
{{ showResults }}選項行中:是否顯示結果
{{ winner }}結束後的勝出選項
{{ requirements }}條件清單:type, text
{{ weights }}身分組權重清單:role, weight
{{ closeConditions.maxVoters / choiceVotes }}自動結束的限制
{{ labels }}伺服器語言的現成文字(title, voters, by, closedNotice, …)
{{ language }}訊息的語言代碼

篩選器

所有一般 Liquid 篩選器(upcase, truncate, join, …)以及以下這些:

timestamp{{ poll.endsAt | timestamp: 'R' }}
number{{ poll.votes | number }}
bar{{ choice.percent | bar: 10 }}
duration{{ 3600 | duration }}
plural{{ poll.voters | plural: 'voter' }}
mention / role / channel{{ poll.creator.id | mention }}

範例

預設標頭

## {% if poll.status == 'closed' %}🔒 {% endif %}{{ poll.question }}

預設頁尾

-# {{ labels.voters }}{% if poll.weighted %} · ⚖️ {{ labels.weighted }}{% endif %}{% if poll.anonymous %} · 🕶️ {{ labels.anonymous }}{% endif %} · {% if poll.status == 'closed' %}{{ labels.closed }} {{ poll.closedAt | timestamp }}{% else %}{{ labels.by }}{% endif %}

預設選項行

{% if choice.winner %}🏆 {% endif %}{% if choice.emoji != '' %}{{ choice.emoji }} {% endif %}**{{ choice.name }}**{% if showResults %}
`{{ choice.percent | bar: 14 }}` **{{ choice.percent | number }}%** · {{ choice.votesText }}{% endif %}

預設結果訊息

🔒 {{ labels.closedNotice }}{% if winner %} {{ labels.winnerNotice }}{% endif %}

提及建立者

{{ poll.creator.id | mention }}

顯示條件

{% if requirements.size > 0 %}-# {{ requirements | map: 'text' | join: ', ' }}{% endif %}

舊版預留位置

上一版的範本仍可使用。以下預留位置依然會被替換:

{POLL_STATE_EMOJI}{POLL_TYPE}{POLL_LINK}{QUESTION}{CREATOR}{CREATOR_ID}{TIME_PARSED}{TIME_INDICATOR}{TIME_LEFT_TIMESTAMP}{TIMESTAMP_R}{TIMESTAMP_FULL}{TIMESTAMP_SHORT}{TIMESTAMP_DATE}{TIMESTAMP_TIME}{ALL_VOTES_COUNT}{ANONYM_POLL}{ALLOWED_TO_VOTE_CHANGE}{MAX_CHOICES}{CREATED_TIMESTAMP}{TIMED_POLL_EMOJI}{ALLOWED_ROLES}