Documentation
¶
Index ¶
- Constants
- type Bot
- func (b *Bot) BotUserID() string
- func (b *Bot) CreateChannel(_ context.Context, _ string) (string, error)
- func (b *Bot) CreateSimpleThread(ctx context.Context, channelID, name, initialMessage string) (string, error)
- func (b *Bot) CreateThread(ctx context.Context, channelID, name, _, message string) (string, error)
- func (b *Bot) DeleteThread(ctx context.Context, threadID string) error
- func (b *Bot) GetChannelName(ctx context.Context, channelID string) (string, error)
- func (b *Bot) GetChannelParentID(ctx context.Context, channelID string) (string, error)
- func (b *Bot) GetOwnerUserID(_ context.Context) (string, error)
- func (b *Bot) HandleIncomingMessage(ctx context.Context, channelID, authorID, content, mode string)
- func (b *Bot) HandleThreadCreated(ctx context.Context, threadID, authorID, message string)
- func (b *Bot) InviteUserToChannel(_ context.Context, _, _ string) error
- func (b *Bot) IsBotUser(userID string) bool
- func (b *Bot) OnChannelDelete(handler func(ctx context.Context, channelID string, isThread bool))
- func (b *Bot) OnChannelJoin(handler func(ctx context.Context, channelID string, platform types.Platform))
- func (b *Bot) OnInteraction(handler func(ctx context.Context, i *bot.Interaction))
- func (b *Bot) OnMessage(handler func(ctx context.Context, msg *bot.IncomingMessage))
- func (b *Bot) PostMessage(_ context.Context, _, _ string) error
- func (b *Bot) RegisterCommands(_ context.Context) error
- func (b *Bot) RemoveCommands(_ context.Context) error
- func (b *Bot) RemoveStopButton(_ context.Context, _, _ string) error
- func (b *Bot) RenameThread(ctx context.Context, threadID, name string) error
- func (b *Bot) SendMessage(_ context.Context, _ *bot.OutgoingMessage) error
- func (b *Bot) SendStopButton(_ context.Context, _, _ string) (string, error)
- func (b *Bot) SendTyping(_ context.Context, _ string) error
- func (b *Bot) SetChannelTopic(_ context.Context, _, _ string) error
- func (b *Bot) Start(ctx context.Context) error
- func (b *Bot) Stop() error
- type LocalStore
Constants ¶
View Source
const ( // BotUserID is the user ID for the local bot. BotUserID = "loop-bot" // BotUsername is the bot name used for @mention detection on local platform. BotUsername = "LoopBot" // DefaultAuthorID is the default author for local platform messages. DefaultAuthorID = "local-user" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot is the local platform bot. It implements orchestrator.Bot with DB-backed thread/channel operations, and api.IncomingMessageHandler for routing API messages through the orchestrator.
func NewBot ¶
func NewBot(store LocalStore, logger *slog.Logger) *Bot
NewBot creates a new local platform Bot.
func (*Bot) CreateChannel ¶
func (*Bot) CreateSimpleThread ¶
func (*Bot) CreateThread ¶
func (*Bot) GetChannelName ¶
func (*Bot) GetChannelParentID ¶
func (*Bot) HandleIncomingMessage ¶
HandleIncomingMessage implements api.IncomingMessageHandler. It parses mentions and command prefixes, then routes the message through the orchestrator.
func (*Bot) HandleThreadCreated ¶
HandleThreadCreated implements api.IncomingMessageHandler. It routes the initial thread message as a bot mention to trigger the agent.
func (*Bot) InviteUserToChannel ¶
func (*Bot) OnChannelDelete ¶
func (*Bot) OnChannelJoin ¶
func (*Bot) OnInteraction ¶
func (b *Bot) OnInteraction(handler func(ctx context.Context, i *bot.Interaction))
func (*Bot) OnMessage ¶
func (b *Bot) OnMessage(handler func(ctx context.Context, msg *bot.IncomingMessage))
func (*Bot) RenameThread ¶
func (*Bot) SendMessage ¶
func (*Bot) SendStopButton ¶
type LocalStore ¶
type LocalStore interface {
GetChannel(ctx context.Context, channelID string) (*db.Channel, error)
UpsertChannel(ctx context.Context, ch *db.Channel) error
DeleteChannel(ctx context.Context, channelID string) error
InsertMessage(ctx context.Context, msg *db.Message) error
}
LocalStore is the subset of db.Store needed by Bot.
Click to show internal directories.
Click to hide internal directories.