I read in the docs that i can be done by wrap the handler in another struct, but im sorry i still little bit confused>
Can someone show me some snippet how to implementing this please
type MyClient struct {
WAClient *whatsmeow.Client
eventHandlerID uint32
}
I read in the docs that i can be done by wrap the handler in another struct, but im sorry i still little bit confused> Can someone show me some snippet how to implementing this please
type MyClient struct { WAClient *whatsmeow.Client eventHandlerID uint32 }
func (mycli *MyClient) register() { mycli.eventHandlerID = mycli.WAClient.AddEventHandler(mycli.myEventHandler) }
func (mycli *MyClient) myEventHandler(evt interface{}) { // Handle event and access mycli.WAClient }