25 lines
1,007 B
Go
25 lines
1,007 B
Go
|
|
package channels
|
||
|
|
|
||
|
|
import "context"
|
||
|
|
|
||
|
|
// TypingCapable — channels that can show a typing/thinking indicator.
|
||
|
|
// StartTyping begins the indicator and returns a stop function.
|
||
|
|
// The stop function MUST be idempotent and safe to call multiple times.
|
||
|
|
type TypingCapable interface {
|
||
|
|
StartTyping(ctx context.Context, chatID string) (stop func(), err error)
|
||
|
|
}
|
||
|
|
|
||
|
|
// MessageEditor — channels that can edit an existing message.
|
||
|
|
// messageID is always string; channels convert platform-specific types internally.
|
||
|
|
type MessageEditor interface {
|
||
|
|
EditMessage(ctx context.Context, chatID string, messageID string, content string) error
|
||
|
|
}
|
||
|
|
|
||
|
|
// PlaceholderRecorder is injected into channels by Manager.
|
||
|
|
// Channels call these methods on inbound to register typing/placeholder state.
|
||
|
|
// Manager uses the registered state on outbound to stop typing and edit placeholders.
|
||
|
|
type PlaceholderRecorder interface {
|
||
|
|
RecordPlaceholder(channel, chatID, placeholderID string)
|
||
|
|
RecordTypingStop(channel, chatID string, stop func())
|
||
|
|
}
|