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

bugfix: message.Type() is a empty value #333

Closed
wants to merge 5 commits into from

Conversation

1046102779
Copy link

@1046102779 1046102779 commented Dec 13, 2022

issue: #332

cc @kkdai @clsung

Signed-off-by: 1046102779 seachen@tencent.com

Signed-off-by: 1046102779 <seachen@tencent.com>
Signed-off-by: 1046102779 <seachen@tencent.com>
@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (424732d) 55.79% compared to head (682959b) 78.79%.

❗ Current head 682959b differs from pull request most recent head f8e9095. Consider uploading reports for the commit f8e9095 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #333       +/-   ##
===========================================
+ Coverage   55.79%   78.79%   +23.00%     
===========================================
  Files          86       39       -47     
  Lines        5420     3565     -1855     
===========================================
- Hits         3024     2809      -215     
+ Misses       2174      576     -1598     
+ Partials      222      180       -42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: 1046102779 <seachen@tencent.com>
@CLAassistant
Copy link

CLAassistant commented Dec 13, 2022

CLA assistant check
All committers have signed the CLA.

@1046102779
Copy link
Author

cc @kkdai.

Help me review this PR. Thanks.

@1046102779
Copy link
Author

cc @kkdai

@kkdai
Copy link
Member

kkdai commented Dec 22, 2022

Hi @1046102779
Please help to check my comment in this PR, thank you.

@yujinlin0224
Copy link

Any update?

My temporary solution:

_, ok := event.Message.(*linebot.TextMessage)

@Yang-33
Copy link
Contributor

Yang-33 commented Dec 1, 2023

@yujinlin0224
This is old package(linebot) now. Although line-bot-sdk-go is welcome to any patch, I highly recommend you use linebot.webhook package(from version 8) and discard old code from your application.

linebot.webhook doesn't have this issue.

for _, event := range cb.Events {
log.Printf("Got event %v", event)
switch e := event.(type) {
case webhook.MessageEvent:
switch message := e.Message.(type) {
case webhook.TextMessageContent:
if err := app.handleText(&message, e.ReplyToken, e.Source); err != nil {
log.Print(err)
}
case webhook.ImageMessageContent:
if err := app.handleImage(&message, e.ReplyToken); err != nil {
log.Print(err)
}
case webhook.VideoMessageContent:
is an example of new package and you can understand how to use it.

go.sum Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
Copy link
Member

@kkdai kkdai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

go.mod Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
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.

None yet

6 participants