From fbef03dcd89e335e4d4d30b5b02209ce1df462c2 Mon Sep 17 00:00:00 2001 From: Alexander Babenko Date: Thu, 24 May 2018 13:26:35 +0300 Subject: [PATCH 1/2] Fix Readme.md example compile time errors Example was not compiled because uses vars (not refs) --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0d1d202..7002f17 100644 --- a/README.md +++ b/README.md @@ -179,21 +179,21 @@ func main() { // myMsgReceivedFunc will be called everytime when user send us a message func myMsgReceivedFunc(v *viber.Viber, u viber.User, m viber.Message, token uint64, t time.Time) { - switch m.(type) { - - case *viber.TextMessage: - v.SendTextMessage(u.ID, "Thank you for your message") - txt := m.(viber.TextMessage).Text - v.SendTextMessage(u.ID, "This is the text you have sent to me " + txt) - - case *viber.URLMessage: - url := m.(*viber.URLMessage).Media) - v.SendTextMessage(u.ID, "You have sent me an interesting link " + url) - - case *viber.ImageMessage: - v.SendTextMessage(u.ID, "Nice pic!") - - } + switch m.(type) { + + case *viber.TextMessage: + v.SendTextMessage(u.ID, "Thank you for your message") + txt := m.(*viber.TextMessage).Text + v.SendTextMessage(u.ID, "This is the text you have sent to me "+txt) + + case *viber.URLMessage: + url := m.(*viber.URLMessage).Media + v.SendTextMessage(u.ID, "You have sent me an interesting link "+url) + + case *viber.PictureMessage: + v.SendTextMessage(u.ID, "Nice pic!") + + } } func myDeliveredFunc(v *viber.Viber, userID string, token uint64, t time.Time) { From bef7ff2c258dc0094f9cb0e10b16de88821a923c Mon Sep 17 00:00:00 2001 From: Alexander Babenko Date: Thu, 24 May 2018 13:31:29 +0300 Subject: [PATCH 2/2] Fix my tabs to 4 spaces --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7002f17..d76500c 100644 --- a/README.md +++ b/README.md @@ -179,21 +179,21 @@ func main() { // myMsgReceivedFunc will be called everytime when user send us a message func myMsgReceivedFunc(v *viber.Viber, u viber.User, m viber.Message, token uint64, t time.Time) { - switch m.(type) { + switch m.(type) { - case *viber.TextMessage: - v.SendTextMessage(u.ID, "Thank you for your message") - txt := m.(*viber.TextMessage).Text - v.SendTextMessage(u.ID, "This is the text you have sent to me "+txt) + case *viber.TextMessage: + v.SendTextMessage(u.ID, "Thank you for your message") + txt := m.(*viber.TextMessage).Text + v.SendTextMessage(u.ID, "This is the text you have sent to me "+txt) - case *viber.URLMessage: - url := m.(*viber.URLMessage).Media - v.SendTextMessage(u.ID, "You have sent me an interesting link "+url) + case *viber.URLMessage: + url := m.(*viber.URLMessage).Media + v.SendTextMessage(u.ID, "You have sent me an interesting link "+url) - case *viber.PictureMessage: - v.SendTextMessage(u.ID, "Nice pic!") + case *viber.PictureMessage: + v.SendTextMessage(u.ID, "Nice pic!") - } + } } func myDeliveredFunc(v *viber.Viber, userID string, token uint64, t time.Time) {