Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Outdated Client and Send Message Errors #93

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jonas-is-coding
Copy link

This pull request addresses two main issues encountered in the whatsapp-gpt project:

  1. Outdated Client Error: Updated the Go packages to resolve issues with WebSocket connection errors caused by an outdated WhatsApp client.
  2. Send Message Error: Modified the message-sending logic to comply with the latest WhatsApp package syntax and ensure proper message delivery.

Changes Made:

  1. Updated Packages:

    • Upgraded all Go packages to resolve the "Client outdated" error during WebSocket connection.
  2. Message Sending Fix:

    • Updated the SendMessage method usage to fit the new syntax of the WhatsApp package. This ensures the bot can successfully send responses.

Code Example:

Before:

mycli.WAClient.SendMessage(context.Background(), userJid, "", response)

After:

_, err = mycli.WAClient.SendMessage(context.Background(), userJid, response, whatsmeow.SendRequestExtra{})
if err != nil {
    fmt.Println("Error sending message:", err)
}

Testing Instructions:

  1. Clone the repository and navigate to the project directory.
  2. Update and install the required Go packages:
    go mod tidy
    go get -u ./...
  3. Ensure the chatbot API is running (e.g., using python server.py).
  4. Run the project:
    go run main.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant