whatsapp

package
v0.0.0-...-9d454ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(wac *whatsapp.Conn, filepath string) error

Login to whatsapp

func SaveSession

func SaveSession(session whatsapp.Session, filepath string) error

SaveSession writes a session to a filepath

Types

type MessageHandler

type MessageHandler struct {
	// contains filtered or unexported fields
}

MessageHandler manages messages sent from a whatsapp connection

func NewMessageHandler

func NewMessageHandler(wac *whatsapp.Conn) *MessageHandler

NewMessageHandler creates a new Message Handler

func (*MessageHandler) HandleError

func (mh *MessageHandler) HandleError(err error)

HandleError log error

func (*MessageHandler) HandleTextMessage

func (mh *MessageHandler) HandleTextMessage(message whatsapp.TextMessage)

HandleTextMessage receives whatsapp text messages and checks if the message was send by the current user, if it does not contain the keyword '@echo' or if it is from before the program start and then returns. Otherwise the message is echoed back to the original author.

func (*MessageHandler) SendText

func (mh *MessageHandler) SendText(message *whatsapp.TextMessage, text string) error

SendText send a text message

func (*MessageHandler) StartTime

func (mh *MessageHandler) StartTime() uint64

StartTime get start time

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL