Skip to content

Commit ef5ec6f

Browse files
tracyboehrerVirtual-Josh
authored andcommitted
Fixes #425: Using incorrect BotState (#426)
1 parent 11d244a commit ef5ec6f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

samples/45.state-management/bots/state_management_bot.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Licensed under the MIT License.
33

44
import time
5-
import pytz
65
from datetime import datetime
76

87
from botbuilder.core import ActivityHandler, ConversationState, TurnContext, UserState
@@ -25,10 +24,10 @@ def __init__(self, conversation_state: ConversationState, user_state: UserState)
2524
self.conversation_state = conversation_state
2625
self.user_state = user_state
2726

28-
self.conversation_data = self.conversation_state.create_property(
27+
self.conversation_data_accessor = self.conversation_state.create_property(
2928
"ConversationData"
3029
)
31-
self.user_profile = self.conversation_state.create_property("UserProfile")
30+
self.user_profile_accessor = self.user_state.create_property("UserProfile")
3231

3332
async def on_turn(self, turn_context: TurnContext):
3433
await super().on_turn(turn_context)
@@ -47,8 +46,8 @@ async def on_members_added_activity(
4746

4847
async def on_message_activity(self, turn_context: TurnContext):
4948
# Get the state properties from the turn context.
50-
user_profile = await self.user_profile.get(turn_context, UserProfile)
51-
conversation_data = await self.conversation_data.get(
49+
user_profile = await self.user_profile_accessor.get(turn_context, UserProfile)
50+
conversation_data = await self.conversation_data_accessor.get(
5251
turn_context, ConversationData
5352
)
5453

0 commit comments

Comments
 (0)