-
Notifications
You must be signed in to change notification settings - Fork 69
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
Line handlers #114
Line handlers #114
Conversation
handlers/line/line.go
Outdated
|
||
} | ||
|
||
return []courier.Event{msgs[0]}, courier.WriteMsgSuccess(ctx, w, r, msgs) |
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.
Should be returning all msgs, not just [0]
// }, | ||
// { | ||
// "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA", | ||
// "type": "follow", |
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.
Do we not support follows?
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.
No
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.
Any reason why not?
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.
I guess if we don't support it in the past that's ok to leave it off for now.
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.
right
handlers/line/line.go
Outdated
if len(lineRequest.Events) > 0 { | ||
return nil, courier.WriteAndLogRequestIgnored(ctx, w, r, channel, "ignoring request, no message") | ||
} | ||
return nil, courier.WriteAndLogRequestError(ctx, w, r, channel, fmt.Errorf("missing message, source or type in the event")) |
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.
Not sure I understand this case.. is this really an error?
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.
If the events list was empty we return an error, otherwise the event were just ignored by us
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.
Seems if the list is empty we should just ignore it too, if its valid JSON that's just fine.
if err != nil { | ||
return status, err | ||
} | ||
status.SetStatus(courier.MsgWired) |
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.
Any external id to parse?
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.
the docs says they just return a 200 and and empty JSON
handlers/line/line.go
Outdated
) | ||
|
||
var sendURL = "https://api.line.me/v2/bot/message/push" | ||
var maxMsgLength = 1600 |
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.
Do we know what this is exactly from their API docs?
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.
I see it is 2000 on the docs, I update that
Fixes #96