chat

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App interface {
	store.Store

	DebugLog() debug.Logger
	ErrorLog() debug.Logger
	FreeFeedAPI() *frf.API
	Tg() *tg.BotAPI
	Send(tg.Chattable) (tg.Message, error)
	Linkify(string) string
	ContentOf(string) string

	StartRealtime(ID)
	StopRealtime(ID)

	EventsPaused(ID) bool
	PauseEvents(ID)
	ResumeEvents(ID)

	RTSend(chatID types.TgChatID, cmd string, payload interface{}, reply interface{}) error
}

type Chat

type Chat struct {
	ID    ID
	State *store.State
	App   App
	// contains filtered or unexported fields
}

func New

func New(id ID, app App) (*Chat, error)

func (*Chat) HandleUpdate

func (c *Chat) HandleUpdate(update tg.Update)

func (*Chat) ProcessEvents

func (c *Chat) ProcessEvents(events []*frf.Event)

func (*Chat) Should

func (c *Chat) Should(value interface{}, err error) (interface{}, error)

Should logs non-fatal errors

func (*Chat) ShouldOK

func (c *Chat) ShouldOK(err error) error

ShouldOK logs non-fatal errors

func (*Chat) ShouldSend

func (c *Chat) ShouldSend(msg tg.Chattable) (tg.Message, error)

func (*Chat) ShouldSendAndSave

func (c *Chat) ShouldSendAndSave(msg tg.Chattable, rec store.SentMsgRec) (tg.Message, error)

type ID

type ID = types.TgChatID

Jump to

Keyboard shortcuts

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