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

Resolve youpin-city/youpin-bot#8 #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

puripant
Copy link

@puripant puripant commented Oct 1, 2016

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.

…he first step

Add buttons to report a new image or change language
@puripant puripant changed the title #8 Resolve youpin-city/youpin-bot#8 Oct 1, 2016
Copy link
Member

@tvirot tvirot left a 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 );
Copy link
Member

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?

Copy link
Author

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, 'หรือมีอย่างอื่นให้ป้ายุพินช่วยจ๊ะ',
Copy link
Member

@tvirot tvirot Oct 2, 2016

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) {
Copy link
Member

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

@puripant
Copy link
Author

puripant commented Oct 2, 2016

I hope it works now. Somehow I cannot get YouPin API up so I haven't really tested the code :( Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants