Add new build tag for WhatsApp native support to keep the binary smaller.

This commit is contained in:
Aditya Kalro
2026-02-22 19:22:32 -08:00
parent 76f8ab827f
commit 25362ec763
4 changed files with 31 additions and 4 deletions
+6 -3
View File
@@ -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 {
+16
View File
@@ -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")
}