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

Fixup usage of reply method #231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manoedinata
Copy link

According to whatsapp-web.js offical documentation [1], reply method can be used by specifying:

  1. content: can be string, MessageMedia, or Location
  2. chatId: ID of target chat
  3. options: Additional message options

However, current reply route implementation doesn't support content type other than string content, so replying with MessageMedia or similar won't work.

Since these parameters are very similar with Client.sendMessage() method, we can add switch-case to check the specified contentType, just like we did in sendMessage API route. This way, we can reply with another content type.

[1] https://docs.wwebjs.dev/Message.html#reply

@manoedinata
Copy link
Author

Question: How do I update Swagger JSON file, automatically?

According to whatsapp-web.js offical documentation [1], reply method can
be used by specifying:

  1. `content`: can be string, MessageMedia, or Location
  2. `chatId`: ID of target chat
  3. `options`: Additional message options

However, current `reply` route implementation doesn't support content
type other than string content, so replying with MessageMedia or similar
won't work.

Since these parameters are very similar with `Client.sendMessage()` method,
we can add switch-case to check the specified `contentType`, just like
we did in `sendMessage` API route. This way, we can reply with another
content type.

[1] https://docs.wwebjs.dev/Message.html#reply
@manoedinata manoedinata force-pushed the reply-content-fixes branch from b8a5703 to 4a9145e Compare June 14, 2024 11:51
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

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