Documentation
¶
Index ¶
- func Code(err error) string
- type From
- type Listed
- type Refusal
- type Verbs
- func (v *Verbs) Add(ctx context.Context, from From, name string, title *string) (Listed, bool, error)
- func (v *Verbs) Bot(ctx context.Context, from From, words string, count int) (Listed, []mail.Delivery, error)
- func (v *Verbs) Chat(ctx context.Context, from From, words string) (roster.Bot, *sessionsv1.Session, error)
- func (v *Verbs) Fresh(ctx context.Context, from From, words string) (roster.Bot, bool, error)
- func (v *Verbs) Message(ctx context.Context, from From, id string, wait time.Duration) (mail.Delivery, error)
- func (v *Verbs) Messages(ctx context.Context, from From, words string, statuses []string, limit int, ...) ([]mail.Delivery, error)
- func (v *Verbs) Receive(ctx context.Context, from From, handle string, letter mail.Letter) (mail.Delivery, bool, error)
- func (v *Verbs) Remove(ctx context.Context, from From, words string) (roster.Bot, error)
- func (v *Verbs) Resend(ctx context.Context, from From, id string) (mail.Delivery, error)
- func (v *Verbs) Roll(ctx context.Context, from From) (roster.Roll, error)
- func (v *Verbs) Roster(ctx context.Context, from From) ([]Listed, []roster.Unreached, []string, error)
- func (v *Verbs) Run(ctx context.Context, from From, words string) (string, bool, error)
- func (v *Verbs) Send(ctx context.Context, from From, words, text, id string, wait time.Duration) (mail.Delivery, bool, error)
- func (v *Verbs) Stop(ctx context.Context, from From, id, why string) (mail.Delivery, error)
- func (v *Verbs) Unpause(ctx context.Context, from From, words string) (roster.Bot, bool, error)
- func (v *Verbs) Unsent(ctx context.Context, from From, handle string, letter mail.Letter) (mail.Delivery, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type From ¶
Who asks: the profile and session a command was typed in, a person a chat app limits to commands that read, words typed in a chat, and a program of the HTTP API, which reads the messages of its own profile alone
type Listed ¶
type Listed struct {
Bot roster.Bot
// Its Bot Session, nil before it has one and for a bot of a peer
Chat *sessionsv1.Session
// A reply runs in its Bot Session, or a message waits for one
Busy bool
// Newest message of its Bot Session on one line, given by a page alone
Preview string
// The newest session of its profile a user picks from, nil for none and for a bot of a peer
Newest *sessionsv1.Session
Standing mail.Standing
// Title of what its profile runs now that nobody types into, empty for nothing
Working string
// The bot of the profile that asks
Self bool
}
A bot as a list and a page give it: with its Bot Session, how its messages stand and what its profile works on now
type Verbs ¶
type Verbs struct {
// contains filtered or unexported fields
}
The bots as the screens, /bots, the HTTP API and other icebaths reach them: each verb on the roster, the relay and the messages
func Register ¶
func Register(registry *server.Registry, cfg *config.Config, store *mail.Store, bots *roster.Roster, messages *relay.Relay, host *runner.Runner) *Verbs
Serves the bots to the screens and gives back the verbs for /bots and the HTTP API
func (*Verbs) Add ¶
func (v *Verbs) Add(ctx context.Context, from From, name string, title *string) (Listed, bool, error)
Makes the profile of this icebath a bot, with the title given, or gives a bot another title: the bot as it stands, and whether it was a bot already. Its teammates are told of it from their next messages
func (*Verbs) Bot ¶
func (v *Verbs) Bot(ctx context.Context, from From, words string, count int) (Listed, []mail.Delivery, error)
One bot of this icebath or of a peer of the profile that asks, with the newest of its messages, as many as asked for
func (*Verbs) Chat ¶
func (v *Verbs) Chat(ctx context.Context, from From, words string) (roster.Bot, *sessionsv1.Session, error)
The Bot Session of the bot of this icebath, made when it has none
func (*Verbs) Fresh ¶
Puts the Bot Session of the bot of this icebath aside, so its next message starts a new one. Whether it had one
func (*Verbs) Message ¶
func (v *Verbs) Message(ctx context.Context, from From, id string, wait time.Duration) (mail.Delivery, error)
The message of the id, once it ended or the wait passed: a program of the HTTP API reads those of its own profile, and those a bot of another icebath sent, whose id that icebath alone knows
func (*Verbs) Messages ¶
func (v *Verbs) Messages(ctx context.Context, from From, words string, statuses []string, limit int, before time.Time) ([]mail.Delivery, error)
Messages to and from the bot the words name, or to and from every bot of this icebath for none, newest first. A program of the HTTP API lists those of its own profile alone
func (*Verbs) Receive ¶
func (v *Verbs) Receive(ctx context.Context, from From, handle string, letter mail.Letter) (mail.Delivery, bool, error)
Takes the message a bot of another icebath sends to the bot of the handle, under the same id: the delivery as it stands, once it ended or the wait asked for passed, a minute at most, and whether it was taken before
func (*Verbs) Remove ¶
Takes the bot of this icebath off the roster: its profile and its Bot Session stay, and its teammates no longer hear of it
func (*Verbs) Resend ¶
Sends the message of the id again under a new id, one that did not get through
func (*Verbs) Roll ¶
The bots of this icebath as another icebath reads them, the one of the profile it reaches marked as the profile's own
func (*Verbs) Roster ¶
func (v *Verbs) Roster(ctx context.Context, from From) ([]Listed, []roster.Unreached, []string, error)
The bots of this icebath, then those of the peers of the profile that asks, each with its Bot Session and how its messages stand. The peers whose bots could not be read. And the profiles of this icebath that are no bot
func (*Verbs) Run ¶
Run runs the words that follow /bots: their full answer, or ok false with the verb's usage when they are not understood. A chat app's gateway splits a long answer into as many messages as it needs, so nothing is cut here.
func (*Verbs) Send ¶
func (v *Verbs) Send(ctx context.Context, from From, words, text, id string, wait time.Duration) (mail.Delivery, bool, error)
Sends what the user wrote to the bot, as a message the bot answers in its Bot Session as though it was typed there. Under the id given, whose message is given again when it was sent before. Waits for its answer as long as asked, ten minutes at most