Skip to content

Commit

Permalink
Update PetStoreAssistantBot.java
Browse files Browse the repository at this point in the history
  • Loading branch information
chtrembl committed Jan 9, 2024
1 parent 9da6203 commit e121a74
Showing 1 changed file with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ public PetStoreAssistantBot(UserState withUserState) {
this.userState = withUserState;
}

// onTurn processing isn't working with DP, not being used...
// onTurn processing isn't working with DP, not being used to manage state...
@Override
public CompletableFuture<Void> onTurn(TurnContext turnContext) {
LOGGER.info("onTurn incoming text: " + turnContext.getActivity().getText());

return super.onTurn(turnContext)
.thenCompose(saveResult -> userState.saveChanges(turnContext));
}
Expand All @@ -82,7 +84,7 @@ public CompletableFuture<Void> onTurn(TurnContext turnContext) {
protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {
String text = turnContext.getActivity().getText().toLowerCase().trim();

LOGGER.info("incoming text: " + text);
LOGGER.info("onMessageActivity incoming text: " + text);

if (isErroneousRequest(text)) {
return null;
Expand Down Expand Up @@ -212,28 +214,6 @@ protected CompletableFuture<Void> onMembersAdded(

LOGGER.info("onMembersAdded...");

String text = turnContext.getActivity().getText().toLowerCase().trim();

LOGGER.info("incoming text: " + text);


if (isErroneousRequest(text)) {
return null;
}

AzurePetStoreSessionInfo azurePetStoreSessionInfo = configureSession(turnContext, text);

if (azurePetStoreSessionInfo != null && azurePetStoreSessionInfo.getNewText() != null) {
// get the text without the session id and csrf token
text = azurePetStoreSessionInfo.getNewText();
}

// the client browser initialized
if (text.equals("...")) {
return turnContext.sendActivity(
MessageFactory.text(WELCOME_MESSAGE)).thenApply(sendResult -> null);
}

return turnContext.sendActivity(
MessageFactory.text("")).thenApply(sendResult -> null);
}
Expand Down

0 comments on commit e121a74

Please sign in to comment.