mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2025-12-15 19:24:19 +01:00
Corrected the script
This commit is contained in:
@@ -51,11 +51,11 @@ type Key struct {
|
||||
|
||||
func connect(param Parameters) (*whatsmeow.Client, error) {
|
||||
dbLog := waLog.Stdout("Database", "ERROR", true)
|
||||
container, err := sqlstore.New("sqlite3", "file:" + param.WhatsappSessionFile + "?_foreign_keys=on", dbLog)
|
||||
container, err := sqlstore.New(context.Background(), "sqlite3", "file:" + param.WhatsappSessionFile + "?_foreign_keys=on", dbLog)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
deviceStore, err := container.GetFirstDevice()
|
||||
deviceStore, err := container.GetFirstDevice(context.Background())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -94,14 +94,23 @@ func sendMessage(client *whatsmeow.Client, group string, message string, url str
|
||||
return fmt.Errorf("Incorrect group identifier '%s': %v", group, err)
|
||||
}
|
||||
|
||||
msg := &waProto.Message{ExtendedTextMessage: &waProto.ExtendedTextMessage{
|
||||
Text: proto.String(message),
|
||||
Title: proto.String(title),
|
||||
Description: proto.String(title),
|
||||
CanonicalURL: proto.String(url),
|
||||
MatchedText: proto.String(url),
|
||||
JPEGThumbnail: thumbnail,
|
||||
}}
|
||||
// msg := &waProto.Message{ExtendedTextMessage: &waProto.ExtendedTextMessage{
|
||||
// Text: proto.String(message),
|
||||
// Title: proto.String(title),
|
||||
// Description: proto.String(title),
|
||||
// CanonicalUrl: proto.String(url),
|
||||
// MatchedText: proto.String(url),
|
||||
// JPEGThumbnail: thumbnail,
|
||||
// }}
|
||||
msg := &waProto.Message{
|
||||
ExtendedTextMessage: &waProto.ExtendedTextMessage{
|
||||
Text: proto.String(fmt.Sprintf("%s\n%s\n%s", title, message, url)),
|
||||
Title: proto.String(title),
|
||||
Description: proto.String(message),
|
||||
// PreviewType: proto.Uint32(0), // 0 pour un lien standard
|
||||
JPEGThumbnail: thumbnail,
|
||||
},
|
||||
}
|
||||
ts, err := client.SendMessage(context.Background(), jid, msg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error sending message with title '%s': %v", title, err)
|
||||
|
||||
Reference in New Issue
Block a user