Fix go mod issue by removing whatsapp-ext

This commit is contained in:
Wim
2019-06-01 00:53:49 +02:00
parent b79bf7d414
commit 40f1d35415
16 changed files with 32 additions and 1484 deletions

View File

@@ -2,13 +2,22 @@ package bwhatsapp
import (
"encoding/gob"
"encoding/json"
"errors"
"fmt"
"os"
qrcodeTerminal "github.com/Baozisoftware/qrcode-terminal-go"
"github.com/Rhymen/go-whatsapp"
)
type ProfilePicInfo struct {
URL string `json:"eurl"`
Tag string `json:"tag"`
Status int16 `json:"status"`
}
func qrFromTerminal(invert bool) chan string {
qr := make(chan string)
go func() {
@@ -82,3 +91,17 @@ func (b *Bwhatsapp) getSenderNotify(senderJid string) string {
}
return ""
}
func (b *Bwhatsapp) GetProfilePicThumb(jid string) (*ProfilePicInfo, error) {
data, err := b.conn.GetProfilePicThumb(jid)
if err != nil {
return nil, fmt.Errorf("failed to get avatar: %v", err)
}
content := <-data
info := &ProfilePicInfo{}
err = json.Unmarshal([]byte(content), info)
if err != nil {
return info, fmt.Errorf("failed to unmarshal avatar info: %v", err)
}
return info, nil
}