Botkit: simple_storage.js: "Error: could not load data"

Created on 19 Dec 2015  路  4Comments  路  Source: howdyai/botkit

Here's my code

var Botkit = require("botkit");
var simpleStorage = require("./simpleStorage")

...

var controller = Botkit.slackbot({
  debug: false,
  storage: simpleStorage()
});

...

controller.hears(['hello','hi'],'direct_message,direct_mention,mention',
  function(bot, message) {
    bot.reply(message,"Hello!");

    controller.storage.teams.save({id: message.team, foo:"bar"}, function(err){console.log(err)});
    controller.storage.teams.get(message.team, function(err){console.log(err)})
  }
)

Most helpful comment

@RafaelCosman This is the top result for "Botkit storage error Could not load data" right now haha.

For posterity, do you recall what you misunderstood?

All 4 comments

Note that controller.storage.teams.save is sucessfully creating a file under the teams directory containing {"id":"T0CV4J33N","foo":"bar"}. But I get the error Error: could not load data

Could it be that I'm calling get too soon after calling save?

My mistake, I misunderstood how simple_storage.js works.

@RafaelCosman This is the top result for "Botkit storage error Could not load data" right now haha.

For posterity, do you recall what you misunderstood?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

imjul1an picture imjul1an  路  3Comments

matueranet picture matueranet  路  4Comments

znat picture znat  路  4Comments

simpixelated picture simpixelated  路  3Comments

HannanShaik picture HannanShaik  路  3Comments