Messenger παρέχει γρήγορη κουμπιά απάντηση για τα bots, όπως φαίνεται εδώ
Ωστόσο, ήμουν ενδιαφέρονται για να πάρει το ίδιο αποτέλεσμα σε Microsoft Bot Πλαίσιο Chat Interface. Σκέφτηκα μια μέθοδο C # για να κάνει το ίδιο πράγμα που έχει ως εξής:
var reply = activity.CreateReply(Hi, do you want to hear a joke?);
reply.Type = ActivityTypes.Message;
reply.TextFormat = TextFormatTypes.Plain;
reply.SuggestedActions = new SuggestedActions()
{
Actions = new List<CardAction>()
{
new CardAction(){ Title = Yes, Type=ActionTypes.ImBack, Value=Yes },
new CardAction(){ Title = No, Type=ActionTypes.ImBack, Value=No },
new CardAction(){ Title = I don't know, Type=ActionTypes.ImBack, Value=IDontKnow }
}
};
Πώς μπορώ να εφαρμόσουν το ίδιο το Nodejs;
Ενημέρωση κώδικα:
getMyID(session, args){var msg = new builder.Message(session)
.text(Let me know the date and time you are comfortable with..)
.suggestedActions(
builder.SuggestedActions.create(
session,[
builder.CardAction.imBack(session, green, green),
builder.CardAction.imBack(session, blue, blue),
builder.CardAction.imBack(session, red, red)
]
)
);
builder.Prompts.choice(session, msg, [green, blue, red]), function(session, results) {
console.log(results);
session.send('I like ' + results + ' too!');
}}
How to take response from the choices and send message to user from inside this function (the current callback function is not being triggered)?
Console.log δεν λειτουργεί. Βλέπω το παρακάτω στην γραμμή εντολών.
.BotBuilder:prompt-choice - Prompt.returning([object Object])
.BotBuilder:prompt-choice - Session.endDialogWithResult()
/ - Session.endDialogWithResult()













