Documentation
¶
Overview ¶
Package setup is `tinio new`: it raises an agent from one of the characters in characters/, in their own database. Nothing is written until every answer is in; then .env holds only where they live (DATABASE_URL) and the key to their secrets (TINIO_KEY).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FirstMessage ¶
type FirstMessage func(ctx context.Context, token string, wait time.Duration) (int64, string, error)
FirstMessage returns the sender's user ID and first name, and marks the message read so the person doesn't answer it later.
type Prompter ¶
type Prompter interface {
// Input asks for text; current is offered (masked when secret) and kept
// on an empty answer. There must be an answer.
Input(title, current string, secret bool) (string, error)
Select(title string, options []string) (int, error)
Confirm(title string, def bool) (bool, error)
}
type Save ¶
type Save func(ctx context.Context, url, key string, files map[string][]byte, secrets map[string]string) error
Save makes the database at url theirs: files are their sections by file name, secrets sealed with key.
type Setup ¶
type Setup struct {
Ask Prompter
Out io.Writer
// Files has Characters, the folder of characters to start from, and
// Example, what a new .env is written from. Env is on disk.
Files fs.FS
Characters string
Example string
Env string
BotName BotName
FirstMessage FirstMessage
Database Database
Postgres LocalPostgres // nil: none offered
Save Save
Now func() time.Time
}