reactionpicker

package
v0.0.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package reactionpicker is the one-row chooser that `+` opens over the cursored message.

A row rather than a palette command. Reacting is a thing you do TO a message, and the message is already under the cursor — routing it through `:` would mean naming the message a second time, in a surface that has no idea which one you meant.

A fixed set rather than the account's own. Telegram serves a global list and lets a chat narrow it, so the honest set for a chat is two requests away, and a chooser that has to load is a chooser you press and then wait at. These twelve are Telegram's own defaults, in its own order; a chat that has narrowed its set refuses the ones it does not allow, and the refusal says so.

Index

Constants

This section is empty.

Variables

View Source
var Reactions = []string{"👍", "👎", "❤", "🔥", "🎉", "🤩", "😁", "🤔", "😢", "🙏", "👏", "🤯"}

Reactions is the set offered, in Telegram's own order of popularity.

Twelve, because the row has to fit a narrow thread and because a chooser long enough to need scrolling has stopped being quicker than typing.

Functions

func Width

func Width() int

Width is what the row reserves, budgeted with cell.Reserve because every cell of it is an emoji — see the reaction chips in internal/render for why the tables and the terminal disagree about those.

Types

type CancelledMsg

type CancelledMsg struct{}

CancelledMsg is the picker closing without a choice.

type ChosenMsg

type ChosenMsg struct {
	ChatId    int64
	MessageId int64
	Emoji     string
}

ChosenMsg is a reaction the user picked. Emoji is empty when they chose the one they had already left, which Telegram models as removing it.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the picker.

func New

func New(r theme.Roles) Model

func (*Model) Close

func (m *Model) Close()

func (Model) IsVisible

func (m Model) IsVisible() bool

func (Model) Mine added in v0.0.14

func (m Model) Mine() string

Mine is the reaction this account has already left on the message the row is open over, or "" when there is none.

Exposed for the hint registry: enter TAKES OFF a reaction you already left, so a row that said "enter pick" there would be describing the opposite of what happens (decision I-6).

func (*Model) Open

func (m *Model) Open(chatID, messageID int64, mine string)

Open points the picker at a message. mine is the reaction this account has already left on it, or "".

func (*Model) SetHints added in v0.0.14

func (m *Model) SetHints(hints []hintbar.Hint)

SetHints supplies the row's own hint strip. See hintRow's comment in mediaview for why these are handed in rather than written here.

func (*Model) SetRoles

func (m *Model) SetRoles(r theme.Roles)

func (*Model) SetWidth

func (m *Model) SetWidth(w int)

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update handles a keypress while the picker is open.

func (Model) View

func (m Model) View() string

View draws the row.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL