From 4be6b5c56015879d0f334fe9651291682ba38c1e Mon Sep 17 00:00:00 2001 From: Keyur Shah Date: Mon, 16 Sep 2024 16:04:14 +0530 Subject: [PATCH] this is changed --- suarabh/main.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/suarabh/main.go b/suarabh/main.go index 8a827ea..13b203b 100644 --- a/suarabh/main.go +++ b/suarabh/main.go @@ -200,14 +200,21 @@ func AfterSuccessFullConnection() { if !ThisConfig.ReadMessageFromCsv { message = ThisConfig.Message } else if ThisConfig.ReadMessageFromCsv && len(cols) >= 3 && len(cols[2]) > 0 { - message = cols[2] + for index, col := range cols { + if index > 1 { + if len(col) > 0 { + message = strings.ReplaceAll(message, fmt.Sprintf("{{var%d}}", index-1), col) + } + } + } } - if message != "" { + if message != "" && !ThisConfig.AppendMessageToMedia { if resp := SendTextMessage(number, message); !resp { AppendToOutPutFile(fmt.Sprintf("%s,false,Number Not Whatsapp\n", number)) } + message = "" } - if resp := SendMediaMessage(sendFilePath, "", number); !resp { + if resp := SendMediaMessage(sendFilePath, message, number); !resp { AppendToOutPutFile(fmt.Sprintf("%s,false,Number Not Whatsapp\n", number)) } AppendToOutPutFile(fmt.Sprintf("%s,true\n", number))