Reputation: 1012
Hello i have recently published my bot to azure and deployed it to messenger for testing purposes. The first part of the bot ask the user for name and age. How can i reset the whole conversation when the user type "reset"? Like delete all the data saved in memory storage. I am using C# and i save the user data to in-memory storage.
IStorage dataStore = new MemoryStorage();
var conversationState = new ConversationState(dataStore);
options.State.Add(conversationState);
Upvotes: 1
Views: 541
Reputation: 33379
First, I would echo what @JJ_Wailes has said about using the MemoryStorage
provider in a production bot: just don't. 😊
That said, to answer your question directly, yes you can delete all state for a given BotState
(e.g. ConversationState
, UserState
, etc) using the DeleteAsync
API.
Upvotes: 2
Reputation: 2227
Hihi!
In-memory data storage is intended for testing only. This storage is volatile and temporary. The data is cleared each time the bot is restarted. There is no need to 'delete' it, it deletes itself the second you restart the bot. That being said, to 'reset' a bot in the FB messenger channel, when you're on the https://www.messenger.com page, navigate to the gear icon in the upper right:
There will be an option to 'delete' the conversation. Click this, then go to the right side, where there's a list of people. Search for your bot's name once more, and the bot conversation will be started over.
and voila! Reset:
Upvotes: 1