-
Notifications
You must be signed in to change notification settings - Fork 13
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
Resolve youpin-city/youpin-bot#8 #29
base: master
Are you sure you want to change the base?
Conversation
…he first step Add buttons to report a new image or change language
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.
Instead of checking if(!context.isEnglish)
, you should use this pattern:
m.sendText(userid, context.__("First, can you send me photos or videos of the issue you found?"))
and add update the locale files.
See https://github.com/youpin-city/youpin-bot#update-localizations
@@ -184,6 +184,48 @@ module.exports = (m, api, conversation, apiUserId) => { | |||
context.state = STATE_WAIT_INTENT; | |||
|
|||
greet( userid, context ); |
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.
You don't need this anymore, right?
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, I don't!
if (!context.isEnglish) { | ||
m.sendText(userid, `สวัสดีฮ่ะ คุณ ${profile.first_name} ช่วยพินสถานที่ที่พบปัญหา โดยการแชร์ ` + | ||
'location จาก Messenger App บนมือถือของคุณด้วยฮ่า'); | ||
m.sendButton(userid, 'หรือมีอย่างอื่นให้ป้ายุพินช่วยจ๊ะ', |
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.
You might need to wrap this with another setTimeout((), 1000)
to ensure that the buttons are sent after the greeting message.
BTW, I really like this solution 😄
|
||
} else { | ||
context.state = STATE_WAIT_INTENT; | ||
if (context.isEnglish) { |
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 current implementation of greet()
already handle i18n for you. See https://github.com/youpin-city/youpin-bot/blob/master/youpin.js#L60
I hope it works now. Somehow I cannot get YouPin API up so I haven't really tested the code :( Sorry |
Resolve #8
If the first message is a photo that is not a sticker, it will skip the first step.
It also adds buttons to report a new image or change language.