Skip to content
This repository was archived by the owner on Jul 5, 2020. It is now read-only.

Commit 61ce80e

Browse files
committed
Initial Commit
0 parents  commit 61ce80e

10 files changed

+441
-0
lines changed

.eslintrc.json

+305
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"node": true
5+
},
6+
"extends": "eslint:recommended",
7+
"rules": {
8+
"accessor-pairs": "error",
9+
"array-bracket-newline": "error",
10+
"array-bracket-spacing": "error",
11+
"array-callback-return": "error",
12+
"array-element-newline": "error",
13+
"arrow-body-style": "off",
14+
"arrow-parens": [
15+
"error",
16+
"as-needed"
17+
],
18+
"arrow-spacing": [
19+
"error",
20+
{
21+
"after": true,
22+
"before": true
23+
}
24+
],
25+
"block-scoped-var": "error",
26+
"block-spacing": "error",
27+
"brace-style": [
28+
"error",
29+
"1tbs"
30+
],
31+
"callback-return": "error",
32+
"camelcase": "off",
33+
"capitalized-comments": "off",
34+
"class-methods-use-this": "error",
35+
"comma-dangle": "off",
36+
"comma-spacing": [
37+
"error",
38+
{
39+
"after": true,
40+
"before": false
41+
}
42+
],
43+
"comma-style": [
44+
"error",
45+
"last"
46+
],
47+
"complexity": "error",
48+
"computed-property-spacing": [
49+
"error",
50+
"never"
51+
],
52+
"consistent-return": "off",
53+
"consistent-this": "error",
54+
"curly": "off",
55+
"default-case": "error",
56+
"dot-location": [
57+
"error",
58+
"property"
59+
],
60+
"dot-notation": "error",
61+
"eol-last": "error",
62+
"eqeqeq": "off",
63+
"for-direction": "error",
64+
"func-call-spacing": "error",
65+
"func-name-matching": "error",
66+
"func-names": [
67+
"error",
68+
"never"
69+
],
70+
"func-style": [
71+
"error",
72+
"declaration"
73+
],
74+
"function-paren-newline": "error",
75+
"generator-star-spacing": "error",
76+
"getter-return": "error",
77+
"global-require": "off",
78+
"guard-for-in": "error",
79+
"handle-callback-err": "error",
80+
"id-blacklist": "error",
81+
"id-length": "off",
82+
"id-match": "error",
83+
"implicit-arrow-linebreak": [
84+
"error",
85+
"beside"
86+
],
87+
"indent": "off",
88+
"indent-legacy": "off",
89+
"init-declarations": "error",
90+
"jsx-quotes": "error",
91+
"key-spacing": "off",
92+
"keyword-spacing": [
93+
"error",
94+
{
95+
"after": true,
96+
"before": true
97+
}
98+
],
99+
"line-comment-position": "off",
100+
"linebreak-style": [
101+
"off",
102+
"windows",
103+
"unix"
104+
],
105+
"lines-around-comment": "error",
106+
"lines-around-directive": "error",
107+
"lines-between-class-members": "error",
108+
"max-depth": "error",
109+
"max-len": "off",
110+
"max-lines": "error",
111+
"max-nested-callbacks": "error",
112+
"max-params": "off",
113+
"max-statements": "off",
114+
"max-statements-per-line": "error",
115+
"multiline-comment-style": "off",
116+
"multiline-ternary": "error",
117+
"new-cap": "error",
118+
"new-parens": "error",
119+
"newline-after-var": "off",
120+
"newline-before-return": "off",
121+
"newline-per-chained-call": "off",
122+
"no-alert": "error",
123+
"no-array-constructor": "error",
124+
"no-await-in-loop": "error",
125+
"no-bitwise": "error",
126+
"no-buffer-constructor": "error",
127+
"no-caller": "error",
128+
"no-catch-shadow": "error",
129+
"no-confusing-arrow": "error",
130+
"no-continue": "error",
131+
"no-console": "off",
132+
"no-div-regex": "error",
133+
"no-duplicate-imports": "error",
134+
"no-else-return": [
135+
"error",
136+
{
137+
"allowElseIf": true
138+
}
139+
],
140+
"no-empty-function": "error",
141+
"no-eq-null": "error",
142+
"no-eval": "error",
143+
"no-extend-native": "error",
144+
"no-extra-bind": "error",
145+
"no-extra-label": "error",
146+
"no-extra-parens": "off",
147+
"no-floating-decimal": "error",
148+
"no-implicit-coercion": "error",
149+
"no-implicit-globals": "off",
150+
"no-implied-eval": "error",
151+
"no-inline-comments": "off",
152+
"no-invalid-this": "error",
153+
"no-iterator": "error",
154+
"no-label-var": "error",
155+
"no-labels": "error",
156+
"no-lone-blocks": "error",
157+
"no-lonely-if": "error",
158+
"no-loop-func": "error",
159+
"no-magic-numbers": "off",
160+
"no-mixed-operators": "error",
161+
"no-mixed-requires": "error",
162+
"no-multi-assign": "error",
163+
"no-multi-spaces": "off",
164+
"no-multi-str": "error",
165+
"no-multiple-empty-lines": "error",
166+
"no-native-reassign": "error",
167+
"no-negated-condition": "off",
168+
"no-negated-in-lhs": "error",
169+
"no-nested-ternary": "error",
170+
"no-new": "error",
171+
"no-new-func": "error",
172+
"no-new-object": "error",
173+
"no-new-require": "error",
174+
"no-new-wrappers": "error",
175+
"no-octal-escape": "error",
176+
"no-param-reassign": "error",
177+
"no-path-concat": "error",
178+
"no-plusplus": [
179+
"error",
180+
{
181+
"allowForLoopAfterthoughts": true
182+
}
183+
],
184+
"no-process-env": 0,
185+
"no-process-exit": "off",
186+
"no-proto": "error",
187+
"no-prototype-builtins": "error",
188+
"no-restricted-globals": "error",
189+
"no-restricted-imports": "error",
190+
"no-restricted-modules": "error",
191+
"no-restricted-properties": "error",
192+
"no-restricted-syntax": "error",
193+
"no-return-assign": "error",
194+
"no-return-await": "error",
195+
"no-script-url": "error",
196+
"no-self-compare": "error",
197+
"no-sequences": "off",
198+
"no-shadow": "error",
199+
"no-shadow-restricted-names": "error",
200+
"no-spaced-func": "error",
201+
"no-sync": "error",
202+
"no-tabs": "error",
203+
"no-template-curly-in-string": "error",
204+
"no-ternary": "error",
205+
"no-throw-literal": "error",
206+
"no-undef-init": "error",
207+
"no-undefined": "error",
208+
"no-underscore-dangle": "off",
209+
"no-unmodified-loop-condition": "error",
210+
"no-unneeded-ternary": "error",
211+
"no-unused-expressions": "off",
212+
"no-unused-vars": "off",
213+
"no-use-before-define": "off",
214+
"no-useless-call": "error",
215+
"no-useless-computed-key": "error",
216+
"no-useless-concat": "error",
217+
"no-useless-constructor": "error",
218+
"no-useless-rename": "error",
219+
"no-useless-return": "error",
220+
"no-var": "error",
221+
"no-void": "error",
222+
"no-warning-comments": "off",
223+
"no-whitespace-before-property": "error",
224+
"no-with": "error",
225+
"nonblock-statement-body-position": [
226+
"error",
227+
"any"
228+
],
229+
"object-curly-newline": "off",
230+
"object-curly-spacing": "off",
231+
"object-shorthand": "off",
232+
"one-var": "off",
233+
"one-var-declaration-per-line": "error",
234+
"operator-assignment": "error",
235+
"operator-linebreak": "error",
236+
"padded-blocks": "off",
237+
"padding-line-between-statements": "error",
238+
"prefer-arrow-callback": "off",
239+
"prefer-const": "off",
240+
"prefer-destructuring": "off",
241+
"prefer-numeric-literals": "error",
242+
"prefer-promise-reject-errors": "error",
243+
"prefer-reflect": "error",
244+
"prefer-rest-params": "error",
245+
"prefer-spread": "error",
246+
"prefer-template": "off",
247+
"quote-props": "off",
248+
"quotes": "off",
249+
"radix": "error",
250+
"require-await": "error",
251+
"require-jsdoc": "off",
252+
"rest-spread-spacing": "error",
253+
"semi": "off",
254+
"semi-spacing": [
255+
"error",
256+
{
257+
"after": true,
258+
"before": false
259+
}
260+
],
261+
"semi-style": [
262+
"error",
263+
"last"
264+
],
265+
"sort-imports": "error",
266+
"sort-keys": "off",
267+
"sort-vars": "error",
268+
"space-before-blocks": "error",
269+
"space-before-function-paren": "off",
270+
"space-in-parens": [
271+
"error",
272+
"never"
273+
],
274+
"space-infix-ops": "off",
275+
"space-unary-ops": "error",
276+
"spaced-comment": [
277+
"error",
278+
"always"
279+
],
280+
"strict": [
281+
"error",
282+
"never"
283+
],
284+
"switch-colon-spacing": "error",
285+
"symbol-description": "error",
286+
"template-curly-spacing": [
287+
"error",
288+
"never"
289+
],
290+
"template-tag-spacing": "error",
291+
"unicode-bom": [
292+
"error",
293+
"never"
294+
],
295+
"valid-jsdoc": "error",
296+
"vars-on-top": "error",
297+
"wrap-iife": "error",
298+
"wrap-regex": "error",
299+
"yield-star-spacing": "error",
300+
"yoda": [
301+
"error",
302+
"never"
303+
]
304+
}
305+
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
package-lock.json
3+
.env

.sample-env

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FB_PAGE_ID=<FB_PAGE_ID>
2+
FB_WEBHOOK_KEY=<FB_WEBHOOK_KEY>
3+
MONGODB_URI=<MONGODB_URI>
4+
FB_PAGE_TOKEN=<FB_PAGE_TOKEN>
5+
FB_APP_SECRET=<FB_APP_SECRET>

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
(The MIT License)
2+
3+
Copyright (c) 2018 Christos Panagiotakopoulos
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

app.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const dotenv = require('dotenv');
2+
const ebony = require('ebony-framework');
3+
4+
const { database } = ebony.utilities;
5+
6+
dotenv.load();
7+
8+
// Set environment variables
9+
const FB_PAGE_ID = process.env.FB_PAGE_ID;
10+
const FB_WEBHOOK_KEY = process.env.FB_WEBHOOK_KEY;
11+
const MONGODB_URI = process.env.MONGODB_URI;
12+
13+
// Initialize Database
14+
database.init(MONGODB_URI).then(() => {
15+
16+
// Create the bot object
17+
const bot = require('./bot');
18+
19+
// Import modules
20+
const hodor = require('./modules/hodor');
21+
bot.addModule(hodor);
22+
23+
// Initiliaze the webhook
24+
bot.start({
25+
port: 3000,
26+
route: '/fb',
27+
FB_PAGE_ID,
28+
FB_WEBHOOK_KEY
29+
});
30+
31+
}).catch(err => {
32+
console.log(`[Fatal]: `);
33+
console.log(err.stack);
34+
process.exit(1);
35+
});

0 commit comments

Comments
 (0)