diff --git a/lib/storage/simple_storage.js b/lib/storage/simple_storage.js index f91063e33..795298443 100755 --- a/lib/storage/simple_storage.js +++ b/lib/storage/simple_storage.js @@ -56,6 +56,9 @@ module.exports = function(config) { save: function(team_data, cb) { teams_db.save(team_data.id, team_data, cb); }, + delete: function(team_id, cb) { + teams_db.delete(team_id.id, cb); + }, all: function(cb) { teams_db.all(objectsToList(cb)); } @@ -67,6 +70,9 @@ module.exports = function(config) { save: function(user, cb) { users_db.save(user.id, user, cb); }, + delete: function(user_id, cb) { + users_db.delete(user_id.id, cb); + }, all: function(cb) { users_db.all(objectsToList(cb)); } @@ -78,6 +84,9 @@ module.exports = function(config) { save: function(channel, cb) { channels_db.save(channel.id, channel, cb); }, + delete: function(channel_id, cb) { + channels_db.delete(channel_id.id, cb); + }, all: function(cb) { channels_db.all(objectsToList(cb)); } diff --git a/readme.md b/readme.md index b3c493ec6..c889a7b79 100755 --- a/readme.md +++ b/readme.md @@ -246,7 +246,7 @@ Multi-message replies, particularly those that present questions for the end use can be sent using the `bot.startConversation()` function and the related conversation sub-functions. Bots can originate messages - that is, send a message based on some internal logic or external stimulus - -using `bot.say()` method. +using `bot.say()` method. All `message` objects must contain a `text` property, even if it's only an empty string. @@ -704,7 +704,7 @@ and override the built in regular expression matching. ### Receive Middleware Receive middleware can be used to do things like preprocess the message -content using external natural language processing services like Wit.ai. +content using external natural language processing services like Wit.ai. Additional information can be added to the message object for use down the chain. ``` @@ -721,7 +721,7 @@ controller.middleware.receive.use(function(bot, message, next) { ### Send Middleware Send middleware can be used to do things like preprocess the message -content before it gets sent out to the messaging client. +content before it gets sent out to the messaging client. ``` controller.middleware.send.use(function(bot, message, next) { @@ -801,14 +801,17 @@ This system supports freeform storage on a team-by-team, user-by-user, and chann ```javascript controller.storage.users.save({id: message.user, foo:'bar'}, function(err) { ... }); controller.storage.users.get(id, function(err, user_data) {...}); +controller.storage.users.delete(id, function(err) {...}); controller.storage.users.all(function(err, all_user_data) {...}); controller.storage.channels.save({id: message.channel, foo:'bar'}, function(err) { ... }); controller.storage.channels.get(id, function(err, channel_data) {...}); +controller.storage.channels.delete(id, function(err) {...}); controller.storage.channels.all(function(err, all_channel_data) {...}); controller.storage.teams.save({id: message.team, foo:'bar'}, function(err) { ... }); controller.storage.teams.get(id, function(err, team_data) {...}); +controller.storage.teams.delete(id, function(err) {...}); controller.storage.teams.all(function(err, all_team_data) {...}); ```