fake

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fake is a text channel for tests: it renders messages as plain text so conversation scripts can be compared with golden files. Having it from day one keeps the action layer channel-agnostic (ADR 0007).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Button

func Button(m actions.Message, label string) string

Button returns the data of the first button whose label contains label.

func Render

func Render(m actions.Message) string

Render formats a message as text: title, lines, sections (## heading, | table rows), then buttons as [Label](data) rows.

Types

type Channel

type Channel struct {

	// Messages maps chat → message id → latest rendering.
	Messages map[string]map[string]actions.Message
	// Log is every send and edit in order.
	Log []string
	// contains filtered or unexported fields
}

Channel records messages per chat.

func New

func New() *Channel

New returns an empty fake channel.

func (*Channel) Count

func (c *Channel) Count() int

Count returns how many sends and edits happened.

func (*Channel) Edit

func (c *Channel) Edit(_ context.Context, chatID, messageID string, m actions.Message) error

func (*Channel) Last

func (c *Channel) Last() string

Last returns the latest send or edit.

func (*Channel) Name

func (c *Channel) Name() string

func (*Channel) Send

func (c *Channel) Send(_ context.Context, chatID string, m actions.Message) (string, error)

Jump to

Keyboard shortcuts

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