Documentation
¶
Index ¶
- func AnalyzeOggOpus(data []byte) (uint32, []byte, error)
- func ConvertToOpusOgg(inputPath string) (string, error)
- type Client
- func (c *Client) Connect() error
- func (c *Client) ConnectWithQR(ctx context.Context) error
- func (c *Client) Disconnect()
- func (c *Client) DownloadMedia(messageID, chatJID string) (*DownloadMediaResult, error)
- func (c *Client) ForwardMessage(recipient, messageID, fromChatJID string) (*SendMessageResult, error)
- func (c *Client) GetDeviceID() (user string, device uint16)
- func (c *Client) IsAuthenticated() bool
- func (c *Client) IsConnected() bool
- func (c *Client) IsLoggedIn() bool
- func (c *Client) Logout() error
- func (c *Client) RequestBackfill(jidStr string, count int) error
- func (c *Client) SendMedia(recipient, path, caption, replyToMessageID string) (*SendMessageResult, error)
- func (c *Client) SendReaction(chatJID, messageID, emoji string, remove bool) (*SendMessageResult, error)
- func (c *Client) SendText(recipient, text, replyToMessageID string) (*SendMessageResult, error)
- type DownloadMediaResult
- type SendMessageResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalyzeOggOpus ¶
AnalyzeOggOpus computes duration seconds and a 64-byte waveform for WhatsApp PTT.
func ConvertToOpusOgg ¶
ConvertToOpusOgg converts an input audio file to .ogg (Opus) using ffmpeg. Returns the output path (temporary next to input) without removing the input.
Types ¶
type Client ¶
type Client struct {
WA *whatsmeow.Client
Store *store.DB
Logger *slog.Logger
BaseDir string
SyncComplete chan struct{} // Signals when history sync is complete
}
Client wraps a WhatsApp client with store integration.
func (*Client) ConnectWithQR ¶
ConnectWithQR connects to WhatsApp, displaying a QR code if needed.
func (*Client) DownloadMedia ¶
func (c *Client) DownloadMedia(messageID, chatJID string) (*DownloadMediaResult, error)
DownloadMedia looks up media from DB and downloads via whatsmeow.
func (*Client) ForwardMessage ¶
func (c *Client) ForwardMessage(recipient, messageID, fromChatJID string) (*SendMessageResult, error)
ForwardMessage forwards a message to a recipient.
func (*Client) GetDeviceID ¶
GetDeviceID returns the device ID if authenticated.
func (*Client) IsAuthenticated ¶
IsAuthenticated returns true if there's a stored session.
func (*Client) IsConnected ¶
IsConnected returns true if connected to WhatsApp.
func (*Client) IsLoggedIn ¶
IsLoggedIn returns true if logged in to WhatsApp.
func (*Client) RequestBackfill ¶
RequestBackfill requests historical messages for a chat. Note: WhatsApp controls how much history is sent.
func (*Client) SendMedia ¶
func (c *Client) SendMedia(recipient, path, caption, replyToMessageID string) (*SendMessageResult, error)
SendMedia sends an image/video/document/audio with optional caption. If replyToMessageID is provided, sends as a quoted reply.
func (*Client) SendReaction ¶
func (c *Client) SendReaction(chatJID, messageID, emoji string, remove bool) (*SendMessageResult, error)
SendReaction sends a reaction to a message.
type DownloadMediaResult ¶
DownloadMediaResult represents the result of downloading media from WhatsApp.