mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
Add new build tag for WhatsApp native support to keep the binary smaller.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//go:build whatsapp_native
|
||||
|
||||
// PicoClaw - Ultra-lightweight personal AI agent
|
||||
// License: MIT
|
||||
//
|
||||
@@ -58,16 +60,17 @@ type WhatsAppNativeChannel struct {
|
||||
|
||||
// NewWhatsAppNativeChannel creates a WhatsApp channel that uses whatsmeow for connection.
|
||||
// storePath is the directory for the SQLite session store (e.g. workspace/whatsapp).
|
||||
func NewWhatsAppNativeChannel(cfg config.WhatsAppConfig, bus *bus.MessageBus, storePath string) (*WhatsAppNativeChannel, error) {
|
||||
func NewWhatsAppNativeChannel(cfg config.WhatsAppConfig, bus *bus.MessageBus, storePath string) (Channel, error) {
|
||||
base := NewBaseChannel("whatsapp", cfg, bus, cfg.AllowFrom)
|
||||
if storePath == "" {
|
||||
storePath = "whatsapp"
|
||||
}
|
||||
return &WhatsAppNativeChannel{
|
||||
c := &WhatsAppNativeChannel{
|
||||
BaseChannel: base,
|
||||
config: cfg,
|
||||
storePath: storePath,
|
||||
}, nil
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (c *WhatsAppNativeChannel) Start(ctx context.Context) error {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//go:build !whatsapp_native
|
||||
|
||||
package channels
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sipeed/picoclaw/pkg/bus"
|
||||
"github.com/sipeed/picoclaw/pkg/config"
|
||||
)
|
||||
|
||||
// NewWhatsAppNativeChannel returns an error when the binary was not built with -tags whatsapp_native.
|
||||
// Build with: go build -tags whatsapp_native ./cmd/...
|
||||
func NewWhatsAppNativeChannel(cfg config.WhatsAppConfig, bus *bus.MessageBus, storePath string) (Channel, error) {
|
||||
return nil, fmt.Errorf("whatsapp native not compiled in; build with -tags whatsapp_native")
|
||||
}
|
||||
Reference in New Issue
Block a user