Skip to content

Latest commit

 

History

History
338 lines (232 loc) · 10.7 KB

File metadata and controls

338 lines (232 loc) · 10.7 KB

tlgr poll

9 operations. Every one takes the global flags (--json, --plain, -a/--account, --results-only, --select, --dry-run, --yes, --no-input, --flood-wait-max, -v) anywhere on the line.

Command Summary
poll close Stop a poll so the results are final
poll create Create a poll or quiz with every option the GUI exposes
poll get Poll state and results, with the reason voting is blocked
poll option add Add an answer to an open-answer poll
poll option remove Delete an answer from an open-answer poll
poll stats get Poll vote statistics graph (channel admins)
poll unread list Polls in a chat with votes I have not read yet
poll vote Vote in a poll, or retract your vote
poll voter list Who voted, per option (public polls)

poll close

Stop a poll so the results are final.

Closing cannot be undone. An already-closed poll is already: true, not an error.

tlgr poll close <CHAT> <MSG_ID> [OPTIONS]

mutating · destructive (needs --yes off a TTY) · idempotent (reports already) · returns Poll

Argument Type Required Meaning
CHAT chat yes Chat.
MSG_ID msg-id yes Poll message id.

Also invocable as: tlgr poll stop

$ tlgr poll close @team 12345 --json
Catalog coverage (1 full, 0 partial)

Full: poll.stop

poll create

Create a poll or quiz with every option the GUI exposes.

Answers are addressed by index everywhere in this group, and the opaque identifier the server assigned each one comes back in options[].option_b64 for callers that would rather hold the bytes.

tlgr poll create <CHAT> <QUESTION> [OPTION]... [OPTIONS]

mutating · returns Poll

Argument Type Required Meaning
CHAT chat yes Where to post it.
QUESTION text yes The question.
OPTION text one or more Answers, in order.
Flag Type Default Meaning
--allow-adding-options flag Voters may add answers (open answers).
--close-at datetime Auto-close then.
--correct int Correct option index (quiz).
--countries text Restrict voting to these.
--description text Poll description (layer 229).
--duration text Auto-close after this long.
--effect text Animated message effect (private chats).
--explanation text Quiz solution text.
--explanation-file path Media on the solution.
--hide-results flag Hide results until the poll closes.
--media text Media attached to the poll.
--multiple flag Allow multiple answers.
--no-revote flag Disallow changing a vote.
--option-media text Media on one answer.
--paid-stars int Agree to pay N Stars per message.
--parse text md
--protect, --noforwards flag noforwards: block forwarding and saving.
--public-voters flag Everyone can see who voted.
--quick-reply text Send through a business quick reply.
--quiz flag Quiz mode.
--repeat daily weekly biweekly
--reply-to msg-id Reply to this message.
--schedule text Send later; 'online' means when the recipient is next online.
--send-as chat Post as a channel or anonymously.
--shuffle flag Shuffle answer order per viewer.
--silent flag Send without a notification sound.
--subscribers-only flag Only channel subscribers may vote.
--topic msg-id Send inside a forum topic.
--typing number Show a typing action first.
--typing-auto flag Type for a duration estimated from the text length.
$ tlgr poll create @team 'Lunch?' Pizza Sushi --json
Catalog coverage (16 full, 0 partial)

Full: poll.allow-adding-options, poll.allow-revoting, poll.attached-media, poll.close-period, poll.country-restriction, poll.create-regular, poll.hide-results-until-close, poll.multiple-choice, poll.option-media, poll.public-voters, poll.quiz, poll.quiz-explanation, poll.quiz-explanation-media, poll.send-as, poll.shuffle-options, poll.subscribers-only

--description (layer 229) is refused with NOT_SUPPORTED: the pinned Telethon's poll constructor has no such field.

poll get

Poll state and results, with the reason voting is blocked.

can_vote and restriction are computed on the client: closed, already voted on a quiz, subscribers-only or country-restricted. --follow waits for the poll to close instead of streaming, so the answer is still one object.

tlgr poll get <CHAT> <MSG_ID> [OPTIONS]

returns Poll

Argument Type Required Meaning
CHAT chat yes Chat.
MSG_ID msg-id yes Poll message id.
Flag Type Default Meaning
--follow flag Wait for the poll to close, then report.
--follow-for text 5m Give up following after this long.
--hash int Last seen poll hash for a cheap not-modified reply.
--interval text 15s Refresh interval for --follow.
--with-recent-voters flag Resolve the recent-voter peers.

Also invocable as: tlgr poll results

$ tlgr poll get @team 12345 --json
Catalog coverage (5 full, 0 partial)

Full: poll.get-results, poll.live-updates, poll.option-properties, poll.recent-voters-preview, poll.vote-restriction-reasons

poll.option-properties and poll.vote-restriction-reasons have no MTProto method at all; both are the client-side derivation this op publishes as can_vote/restriction and the per-option flags.

poll option add

Add an answer to an open-answer poll.

tlgr poll option add <CHAT> <MSG_ID> <TEXT> [OPTIONS]

mutating · returns Poll

Argument Type Required Meaning
CHAT chat yes Chat.
MSG_ID msg-id yes Poll message id.
TEXT text yes The answer to add.
Flag Type Default Meaning
--media path Media on the new option.
--parse text md
$ tlgr poll option add @team 12345 'Ramen' --json
Catalog coverage (1 full, 0 partial)

Full: poll.add-option

poll option remove

Delete an answer from an open-answer poll.

The votes cast on that answer go with it. Surviving answers keep their ids.

tlgr poll option remove <CHAT> <MSG_ID> <OPTION> [OPTIONS]

mutating · destructive (needs --yes off a TTY) · returns Poll

Argument Type Required Meaning
CHAT chat yes Chat.
MSG_ID msg-id yes Poll message id.
OPTION int yes Option index to delete.
$ tlgr poll option remove @team 12345 2 --json
Catalog coverage (1 full, 0 partial)

Full: poll.delete-option

poll stats get

Poll vote statistics graph (channel admins).

Needs channelFull.can_view_stats. The graph comes back either inline as graph or as an asynchronous token to load later; both are reported rather than one being silently resolved.

tlgr poll stats get <CHAT> <MSG_ID> [OPTIONS]

returns PollStats

Argument Type Required Meaning
CHAT chat yes Channel.
MSG_ID msg-id yes Poll message id.
Flag Type Default Meaning
--dark flag Dark-theme graph.
$ tlgr poll stats get @news 12345 --json
Catalog coverage (1 full, 0 partial)

Full: poll.statistics

poll unread list

Polls in a chat with votes I have not read yet.

--read-all drives messages.readPollVotes until its offset comes back zero; calling it once clears only the first page of the badge.

tlgr poll unread list <CHAT> [OPTIONS]

paginated (PARTICIPANTS cursor) · returns Page[Message]

Argument Type Required Meaning
CHAT chat yes Chat.
Flag Type Default Meaning
--read-all flag Mark every poll vote as read.
--topic msg-id Only this forum topic.

Pagination is transport-level: --limit/-n, --cursor TOKEN, --all (walked inside the daemon, paced by the account's own rate limiter).

$ tlgr poll unread list @team --json
Catalog coverage (2 full, 0 partial)

Full: poll.read-votes, poll.unread-votes

poll vote

Vote in a poll, or retract your vote.

Indices are resolved against the server's own copy of the poll, so --shuffle cannot make the same index mean two things. An empty vector retracts, which quizzes and no-revote polls refuse.

tlgr poll vote <CHAT> <MSG_ID> [OPTION]... [OPTIONS]

mutating · returns Poll

Argument Type Required Meaning
CHAT chat yes Chat.
MSG_ID msg-id yes Poll message id.
OPTION int one or more Option indices.
Flag Type Default Meaning
--retract flag Retract the vote (empty vector).
$ tlgr poll vote @team 12345 0 --json
Catalog coverage (2 full, 0 partial)

Full: poll.retract-vote, poll.vote

poll voter list

Who voted, per option (public polls).

Anonymous polls answer with PERMISSION_DENIED — the list does not exist.

tlgr poll voter list <CHAT> <MSG_ID> [OPTIONS]

paginated (PARTICIPANTS cursor) · returns Page[PollVoter]

Argument Type Required Meaning
CHAT chat yes Chat.
MSG_ID msg-id yes Poll message id.
Flag Type Default Meaning
--option int Only this option index.

Pagination is transport-level: --limit/-n, --cursor TOKEN, --all (walked inside the daemon, paced by the account's own rate limiter).

Also invocable as: tlgr poll voters

$ tlgr poll voter list @team 12345 --json
Catalog coverage (1 full, 0 partial)

Full: poll.get-voters