-
Notifications
You must be signed in to change notification settings - Fork 14
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
add parser for URL that returns image #12
base: master
Are you sure you want to change the base?
Conversation
- if pesan contains image(s), reply will be image(s) with caption - if pesan contains image(s) and json URL, caption will contain parsed JSON response - if there are more than 1 images, only image from the last URL is captioned
if reply != "timeout" { | ||
go sendMessage(wh.c, reply, message.Info.RemoteJid) | ||
// non-nil txt indicates is it a text message | ||
if txt != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not rewrite reply
even if message is parsed successfully, I think the next process has separate logic for determining reply
status. should not affect your current code but this might be breaking.
testURL1, testURL2, testURL3 string | ||
testTextURL1 = testBaseURL + "/text/1" | ||
testTextURL2 = testBaseURL + "/text/2" | ||
testImageURL1 = testBaseURL + "/image/1" | ||
) | ||
|
||
func TestNemoParser(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the testing process
- see add parser for URL that returns image #12 (comment) on How Has This Been Tested? for more details
- edit cmd/testserver/main.go as needed
I'll review this, thank you for helpin us. |
@k1m0ch1 sure thing, let me know if you have any question |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi thank you for contribute to this project, I just test your code, and here is some problem in the comment
I think you only need to fix that I commented,
If you hardly solve the problem, let me know, I'll still merge this PR and pair with my team.
// non-nil txt indicates is it a text message | ||
if txt != nil { | ||
go sendMessage(wh.c, txt.Text, message.Info.RemoteJid) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ronaudinho I think this will make the bot stop and didn't continue to ask the questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
wac.Presence(RJID, whatsapp.PresenceComposing) | ||
msgId, err := wac.Send(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ronaudinho I have this kind of bug from another bot that I develop by sending image the wac.send(msg)
always returned
error sending message: message sending responded with %!d(float64=400)
I'm using this image https://miro.medium.com/max/356/1*EnF9uIN_u2_X7ey24lB7Tg.png
weirldly return "blank" like this
Info: whatsapp.MessageInfo{ | ||
RemoteJid: RJID, | ||
}, | ||
Caption: img.Caption, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ronaudinho this will be much better if the caption from the text message
like example if the coral
have commands message
...
message: "Let's start how cool you are {{https://miro.medium.com/max/356/1*EnF9uIN_u2_X7ey24lB7Tg.png}} man"
...
so this will returned "Let's start how cool you are man"
@ronaudinho also, can you resolve the conflict? it's simple if condition |
sorry i'm a little bit busy at the moment, will try to take a look at it on the weekend |
Description
#2
a lot of changes are whitespace changes made by my linter when working on your existing code.
Type of change
see comments on code for details on possible breaking changes.
How Has This Been Tested?
cmd/testserver
i.ego run cmd/testserver/main.go
from repo rootgo test -run TestNemoParser
to run changes specific to this commitChecklist: