Good night guys, I have a problem sending audio messages, I have tried in many ways but the audio only appears to whoever is sending the receiver the audio does not appear, if i send image or files it is going normally, i even tried to send the audio as a file and it was normally. Does anyone have this problem?
In my example i'm taking an mp3 audio from the web, in case if i use an ogg the same problem, follow code and prints with the results
Good night guys, I have a problem sending audio messages, I have tried in many ways but the audio only appears to whoever is sending the receiver the audio does not appear, if i send image or files it is going normally, i even tried to send the audio as a file and it was normally. Does anyone have this problem?
In my example i'm taking an mp3 audio from the web, in case if i use an ogg the same problem, follow code and prints with the results
`package main
import ( "encoding/gob" "fmt" "github.com/Rhymen/go-whatsapp" qrcodeTerminal "github.com/Baozisoftware/qrcode-terminal-go" "net/http" "os" "time" )
func main() { //create new WhatsApp connection wac, err := whatsapp.NewConn(5 * time.Second) if err != nil { fmt.Fprintf(os.Stderr, "error creating connection: %v\n", err) return }
}
func login(wac *whatsapp.Conn) error { //load saved session session, err := readSession() if err == nil { //restore session session, err = wac.RestoreWithSession(session) if err != nil { return fmt.Errorf("restoring failed: %v\n", err) } } else { //no saved session -> regular login qr := make(chan string) go func() { terminal := qrcodeTerminal.New() terminal.Get(<-qr).Print() }() session, err = wac.Login(qr) if err != nil { return fmt.Errorf("error during login: %v\n", err) } }
}
func readSession() (whatsapp.Session, error) { session := whatsapp.Session{} file, err := os.Open(os.TempDir() + "/whatsappSession.gob") if err != nil { return session, err } defer file.Close() decoder := gob.NewDecoder(file) err = decoder.Decode(&session) if err != nil { return session, err } return session, nil }
func writeSession(session whatsapp.Session) error { file, err := os.Create(os.TempDir() + "/whatsappSession.gob") if err != nil { return err } defer file.Close() encoder := gob.NewEncoder(file) err = encoder.Encode(session) if err != nil { return err } return nil } `
![image](https://user-images.githubusercontent.com/39490460/112372747-f1014800-8cbe-11eb-8aea-84547a6a4c01.png)