https://github.com/tradle/bot-products
https://github.com/tradle/bot-products
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tradle/bot-products
- Owner: tradle
- Created: 2017-02-09T05:43:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-11-10T21:37:54.000Z (over 1 year ago)
- Last Synced: 2025-04-14T23:52:31.722Z (about 1 year ago)
- Language: JavaScript
- Size: 345 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @tradle/bot-products
Sell your users some products. They have waaaaaay too much money
This is a strategy creator, meaning you can give you a set of models and it will create a products strategy around them. In the example below, a bot is created that offers the user a choice of several age-verification related products, the models for which can be found in ['./test/fixtures/agemodels.js'](./test/fixtures/agemodels.js)
## Usage
To get this bot to sell your products, just ask nicely:
```js
// example.js
const createProductsStrategy = require('@tradle/bot-products')
// ./test/fixtures/agemodels.js
const ageModels = require('./test/fixtures/agemodels')
const ageVerificationStrategy = createProductsStrategy({
namespace: 'only.people.old',
models: {
all: ageModels,
private: {},
biz: {}
},
products: getProductModelIds(ageModels)
})
function getProductModelIds (models) {
return Object.keys(models)
.filter(id => models[id].subClassOf === 'tradle.FinancialProduct')
}
module.exports = ageVerificationStrategy
```