Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Add JavaScript flavor to syntax blocks #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Then pass the returned storage when creating your Botkit controller. Botkit will

Make sure everything you store has an `id` property, that's what you'll use to look it up later.

```
```javascript
var Botkit = require('botkit'),
mongoStorage = require('botkit-storage-mongo')({mongoUri: '...', tables: ['optional','list', 'of', 'custom','tables', 'to', 'add']}),
controller = Botkit.slackbot({
storage: mongoStorage
});
```

```
```javascript
// then you can use the Botkit storage api, make sure you have an id property
var beans = {id: 'cool', beans: ['pinto', 'garbanzo']};
controller.storage.teams.save(beans);
Expand All @@ -41,21 +41,21 @@ controller.storage.teams.get('cool', function(error, beans){

You can also get all entries from a table or find a selected set depending on a parameters.

```
```javascript
storage.users.all(function(error, users){
// do something with users
});
```

```
```javascript
storage.users.find({team_id: team_id}, function(error, users){
// do something with users
});
```

As of 1.0.6, all functions also support Promise syntax:

```
```javascript
storage.users.all().then(function(list_of_users) {

// do something
Expand Down