Documentation
¶
Index ¶
- type BisonBotAdapter
- type BotInterface
- type Command
- type CommandFunc
- type CommandHandler
- type DBManagerInterface
- type ExternalBilling
- type GCReceivedMsg
- type GenerationRequest
- type MessageContext
- type MessageSender
- func (s *MessageSender) SendErrorMessage(ctx context.Context, msgCtx MessageContext, err error) error
- func (s *MessageSender) SendMessage(ctx context.Context, msgCtx MessageContext, message string) error
- func (s *MessageSender) SendSuccessMessage(ctx context.Context, msgCtx MessageContext, message string) error
- type ReceivedPM
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BisonBotAdapter ¶
type BisonBotAdapter struct {
// contains filtered or unexported fields
}
BisonBotAdapter adapts *kit.Bot to the BotInterface This allows us to use *kit.Bot where BotInterface is required and provides the required SendPM, SendGC, and SendGCMessage methods with the correct signatures.
func NewBisonBotAdapter ¶
func NewBisonBotAdapter(bot *kit.Bot) *BisonBotAdapter
func (*BisonBotAdapter) SendGCMessage ¶
func (*BisonBotAdapter) SendPM ¶
func (a *BisonBotAdapter) SendPM(ctx context.Context, uid zkidentity.ShortID, msg string) error
type BotInterface ¶
type BotInterface interface {
SendPM(ctx context.Context, uid zkidentity.ShortID, msg string) error
SendGC(ctx context.Context, gc string, msg string) error
SendGCMessage(ctx context.Context, gc string, channel string, msg string) error
}
BotInterface defines the interface for bot operations
type Command ¶
type Command struct {
Name string
Description string
Category string
Handler CommandHandler
}
Command represents a bot command
type CommandFunc ¶
type CommandFunc func(ctx context.Context, msgCtx MessageContext, args []string, sender *MessageSender, db DBManagerInterface) error
CommandFunc is a function type that implements CommandHandler
func (CommandFunc) Handle ¶
func (f CommandFunc) Handle(ctx context.Context, msgCtx MessageContext, args []string, sender *MessageSender, db DBManagerInterface) error
Handle implements the CommandHandler interface for CommandFunc
type CommandHandler ¶
type CommandHandler interface {
Handle(ctx context.Context, msgCtx MessageContext, args []string, sender *MessageSender, db DBManagerInterface) error
}
CommandHandler defines the interface for command handlers
type DBManagerInterface ¶
type DBManagerInterface interface {
GetBalance(userID string) (int64, error)
UpdateBalance(userID string, amount int64) error
Close() error
}
DBManagerInterface defines the interface for database operations
type ExternalBilling ¶
type ExternalBilling struct {
ChargedDCR float64
ChargedUSD float64
BalanceDCR float64 // balance after the charge
}
ExternalBilling reports a charge that was already applied by an external biller (the MCP harness) before the service ran. Services with internal billing disabled include it in the status DMs instead of reporting billing as disabled.
type GCReceivedMsg ¶
GCReceivedMsg represents a received group chat message
type GenerationRequest ¶
type GenerationRequest struct {
ModelName string
ModelType string
Progress fal.ProgressCallback
UserNick string
UserID zkidentity.ShortID
PriceUSD float64
IsPM bool // Whether this is a private message
GC string // Group chat name if not PM
ExternalBilling *ExternalBilling
}
GenerationRequest contains fields common to all generation service requests (video, image, speech).
type MessageContext ¶
type MessageContext struct {
// Common fields
Nick string // User's nickname
Uid []byte // User's ID
Message string // The message content
// Context-specific fields
IsPM bool // Whether this is a private message
Sender zkidentity.ShortID // Sender's ID (for PM)
GC string // Group chat ID (for GC)
}
MessageContext represents a unified message context for both PM and group chat messages
type MessageSender ¶
type MessageSender struct {
// contains filtered or unexported fields
}
MessageSender provides a unified interface for sending messages in both PM and group chat contexts
func NewMessageSender ¶
func NewMessageSender(bot BotInterface) *MessageSender
NewMessageSender creates a new MessageSender instance
func (*MessageSender) SendErrorMessage ¶
func (s *MessageSender) SendErrorMessage(ctx context.Context, msgCtx MessageContext, err error) error
SendErrorMessage sends an error message to the user
func (*MessageSender) SendMessage ¶
func (s *MessageSender) SendMessage(ctx context.Context, msgCtx MessageContext, message string) error
SendMessage sends a message to the user in the appropriate context
func (*MessageSender) SendSuccessMessage ¶
func (s *MessageSender) SendSuccessMessage(ctx context.Context, msgCtx MessageContext, message string) error
SendSuccessMessage sends a success message to the user
type ReceivedPM ¶
ReceivedPM represents a received private message