消息模板
投票的头部、页脚、子区消息和结果消息都是 Liquid 模板。可在 控制面板 → 消息 中编辑;预览会随输入实时更新。
结果
变量
{{ 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}