Browse Source

update refactor code to make eficient in variable name for pairing function agent type

pull/61/head
Dimas Restu H 2 years ago
parent
commit
c58e6dbc2f
  1. 4
      .env.example
  2. 5
      pkg/whatsapp/whatsapp.go

4
.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

5
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
}

Loading…
Cancel
Save