Skip to content

Commit bc3d1f9

Browse files
Merge pull request #30 from hubot-archive/use-official-library
Use official `@mailchimp/mailchimp_marketing` library
2 parents 2c7babd + a99cbd5 commit bc3d1f9

File tree

12 files changed

+2542
-998
lines changed

12 files changed

+2542
-998
lines changed

.eslintrc.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
commonjs: true,
5+
es2021: true,
6+
},
7+
extends: 'airbnb-base',
8+
overrides: [
9+
],
10+
parserOptions: {
11+
ecmaVersion: 'latest',
12+
},
13+
rules: {
14+
},
15+
};

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ Then add `hubot-mailchimp` to your `external-scripts.json`:
2222

2323
## Configuration
2424

25-
| Configuration Variable | Required | Description |
26-
| ----------------------------- | -------- | --------------------------------- |
27-
| `MAILCHIMP_API_KEY` | **Yes** | API key for your Hubot integration. |
28-
| `MAILCHIMP_LIST_ID` | **Yes** | The unique identifier for the desired list. |
25+
| Configuration Variable | Required | Description |
26+
| ------------------------- | -------- | ------------------------------------------ |
27+
| `MAILCHIMP_API_KEY` | **Yes** | API key for your Hubot integration |
28+
| `MAILCHIMP_LIST_ID` | **Yes** | The unique identifier for the desired list |
29+
| `MAILCHIMP_SERVER_PREFIX` | **Yes** | Server identifier, e.g. `us10` |
2930

3031
## Sample Interaction
3132

index.coffee

Lines changed: 0 additions & 12 deletions
This file was deleted.

index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
module.exports = function (robot, scripts) {
5+
const scriptsPath = path.resolve(__dirname, 'src');
6+
if (fs.existsSync(scriptsPath)) {
7+
return (() => {
8+
const result = [];
9+
for (const script of Array.from(fs.readdirSync(scriptsPath).sort())) {
10+
if ((scripts != null) && !Array.from(scripts).includes('*')) {
11+
if (Array.from(scripts).includes(script)) { result.push(robot.loadFile(scriptsPath, script)); } else {
12+
result.push(undefined);
13+
}
14+
} else {
15+
result.push(robot.loadFile(scriptsPath, script));
16+
}
17+
}
18+
return result;
19+
})();
20+
}
21+
};

0 commit comments

Comments
 (0)