From c58e6dbc2f8a908fda35af0258a69d5d5eef5bb4 Mon Sep 17 00:00:00 2001 From: Dimas Restu H Date: Mon, 16 Oct 2023 21:17:52 +0700 Subject: [PATCH] update refactor code to make eficient in variable name for pairing function agent type --- .env.example | 4 ++-- pkg/whatsapp/whatsapp.go | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 104256d..233bb25 100644 --- a/.env.example +++ b/.env.example @@ -40,8 +40,8 @@ WHATSAPP_MEDIA_IMAGE_COMPRESSION=true WHATSAPP_MEDIA_IMAGE_CONVERT_WEBP=true # WHATSAPP_VERSION_MAJOR=2 -# WHATSAPP_VERSION_MINOR=2323 -# WHATSAPP_VERSION_PATCH=4 +# WHATSAPP_VERSION_MINOR=2344 +# WHATSAPP_VERSION_PATCH=53 # ----------------------------------- # 3rd Party Configuration diff --git a/pkg/whatsapp/whatsapp.go b/pkg/whatsapp/whatsapp.go index c3c6d95..8f236ec 100644 --- a/pkg/whatsapp/whatsapp.go +++ b/pkg/whatsapp/whatsapp.go @@ -33,7 +33,6 @@ var ( WhatsAppClientProxyURL string WhatsAppUserAgentName string WhatsAppUserAgentType string - WhatsAppPairAgentType whatsmeow.PairClientType ) func init() { @@ -66,8 +65,6 @@ func init() { log.Print(nil).Fatal("Error Parse Environment Variable for WhatsApp Client User Agent Type") } - WhatsAppPairAgentType = WhatsAppGetPairAgent(WhatsAppUserAgentType) - WhatsAppDatastore = datastore } @@ -255,7 +252,7 @@ func WhatsAppPairPhone(jid string) (string, int, error) { } // Request Pairing Code - code, err := WhatsAppClient[jid].PairPhone(jid, true, WhatsAppPairAgentType, WhatsAppUserAgentName) + code, err := WhatsAppClient[jid].PairPhone(jid, true, WhatsAppGetPairAgent(WhatsAppUserAgentType), WhatsAppUserAgentName) if err != nil { return "", 0, err }