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 3, 2024
1 parent c7d33b4 commit 087bd58
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

package com.chtrembl.petstoreassistant;

import java.lang.reflect.Field;
import java.util.List;
import java.util.concurrent.CompletableFuture;

Expand Down Expand Up @@ -82,6 +83,10 @@ protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {
.getAzurePetStoreSessionInfo(text);

//DEBUG ONLY
if (text.contains("context")) {
printTurnContext(turnContext);
}

if (text.contains("variables")) {
if(azurePetStoreSessionInfo != null && azurePetStoreSessionInfo.getNewText() != null)
{
Expand Down Expand Up @@ -255,4 +260,48 @@ private String getVariables() {
}
return debug;
}

public void printTurnContext(TurnContext turnContext) {
try{
LOGGER.info("Turn Context Properties:");
turnContext.getActivity().getProperties().forEach((key, value) -> {
LOGGER.info(key + ": " + value.toString());
});
}
catch(Exception e)
{

}

try{
LOGGER.info("Turn Context Attachments:");
turnContext.getActivity().getAttachments().forEach((attachment) -> {
LOGGER.info(attachment.getName());
});
}
catch(Exception e)
{

}

try{
LOGGER.info("Turn Context Properties:");
turnContext.getActivity().getProperties().forEach((key, value) -> {
LOGGER.info(key + ": " + value.toString());
});
}
catch(Exception e)
{

}

try{
LOGGER.info("Turn Context Channel Data:");
LOGGER.info("channel data: "+turnContext.getActivity().getChannelData());
}
catch(Exception e)
{

}
}
}

0 comments on commit 087bd58

Please sign in to comment.