mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2025-12-16 11:44:18 +01:00
Tried to improve the preview on iOS
This commit is contained in:
@@ -79,7 +79,7 @@ func connect(param parameters) (*whatsmeow.Client, error) {
|
|||||||
return client, nil
|
return client, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendMessage(client *whatsmeow.Client, group string, message string, title string, thumbnail []byte) error {
|
func sendMessage(client *whatsmeow.Client, group string, message string, url string, title string, thumbnail []byte) error {
|
||||||
jid, err := types.ParseJID(group)
|
jid, err := types.ParseJID(group)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Incorrect group identifier '%s': %v", group, err)
|
return fmt.Errorf("Incorrect group identifier '%s': %v", group, err)
|
||||||
@@ -87,10 +87,13 @@ func sendMessage(client *whatsmeow.Client, group string, message string, title s
|
|||||||
|
|
||||||
msg := &waProto.Message{ExtendedTextMessage: &waProto.ExtendedTextMessage{
|
msg := &waProto.Message{ExtendedTextMessage: &waProto.ExtendedTextMessage{
|
||||||
Text: proto.String(message),
|
Text: proto.String(message),
|
||||||
|
Title: proto.String(title),
|
||||||
Description: proto.String(title),
|
Description: proto.String(title),
|
||||||
|
CanonicalUrl: proto.String(url),
|
||||||
|
MatchedText: proto.String(url),
|
||||||
JpegThumbnail: thumbnail,
|
JpegThumbnail: thumbnail,
|
||||||
}}
|
}}
|
||||||
ts, err := client.SendMessage(jid, "", msg)
|
ts, err := client.SendMessage(context.Background(), jid, "", msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error sending message with title '%s': %v", title, err)
|
return fmt.Errorf("Error sending message with title '%s': %v", title, err)
|
||||||
}
|
}
|
||||||
@@ -205,7 +208,7 @@ func runLoop(param parameters) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send the message
|
// Send the message
|
||||||
sendMessage(client, param.whatsappGroup, fmt.Sprintf("Il y a %d an(s) : %s", time.Now().Year()-albumDate.Year(), url), albumName, thumbnail)
|
sendMessage(client, param.whatsappGroup, fmt.Sprintf("Il y a %d an(s) : %s", time.Now().Year()-albumDate.Year(), url), url, albumName, thumbnail)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error sending message to WhatsApp for album '%s': %v\n", albumName, err)
|
fmt.Fprintf(os.Stderr, "Error sending message to WhatsApp for album '%s': %v\n", albumName, err)
|
||||||
continue
|
continue
|
||||||
@@ -248,7 +251,7 @@ func runLoop(param parameters) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send the message
|
// Send the message
|
||||||
sendMessage(client, param.whatsappGroup, fmt.Sprintf("Nouvel album : %s", url), albumName, thumbnail)
|
sendMessage(client, param.whatsappGroup, fmt.Sprintf("Nouvel album : %s", url), url, albumName, thumbnail)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Error sending message to WhatsApp for album '%s': %v\n", albumName, err)
|
fmt.Fprintf(os.Stderr, "Error sending message to WhatsApp for album '%s': %v\n", albumName, err)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user