2020-07-21 21:00:35 +09:00
|
|
|
const { App: BoltApp } = require("@slack/bolt");
|
2019-07-27 01:30:19 +09:00
|
|
|
|
2020-07-21 21:00:35 +09:00
|
|
|
class App extends BoltApp {
|
2020-07-17 20:07:32 +09:00
|
|
|
/**
|
2020-07-21 21:00:35 +09:00
|
|
|
* @param {import("@slack/bolt").AppOptions} opt
|
2020-07-17 20:07:32 +09:00
|
|
|
*/
|
2020-07-21 21:00:35 +09:00
|
|
|
constructor(opt) {
|
|
|
|
super(opt);
|
|
|
|
const scripts = require("glob").sync("./scripts/*.js").map(require);
|
|
|
|
scripts.forEach((script) => {
|
|
|
|
if (Array.isArray(script)) return this.message(...script);
|
|
|
|
if (script instanceof Function) return script(this);
|
|
|
|
});
|
2020-07-17 20:07:32 +09:00
|
|
|
}
|
|
|
|
}
|
2020-07-21 21:00:35 +09:00
|
|
|
module.exports = App;
|