Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.

Commit 20e64ea

Browse files
committed
Add support for clearing the bot memory
1 parent 307bd07 commit 20e64ea

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

source/bot.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,14 @@ bot.memory = {
315315
clearTimeout( this.saveIntervalId );
316316
setTimeout( this.saveLoop.bind(this), this.saveInterval );
317317
}
318+
319+
clear : function () {
320+
Object.iterate( localStorage, function ( key, val ) {
321+
if ( key.startsWith('bot_') ) {
322+
localStorage.removeItem(key);
323+
}
324+
});
325+
this.data = {};
318326
};
319327

320328
bot.memory.loadAll();

0 commit comments

Comments
 (0)