mirror of
https://github.com/kou029w/daraz-san.git
synced 2025-01-18 16:08:06 +00:00
Initial commit
This commit is contained in:
commit
7c822a33a4
7 changed files with 2320 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/node_modules/
|
26
README.md
Normal file
26
README.md
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# だらずさん ⚡
|
||||||
|
|
||||||
|
[Slack ⚡ Bolt](https://github.com/SlackAPI/bolt) で作り直した [だらずさん](https://github.com/daraz-tek/daraz-bot)
|
||||||
|
|
||||||
|
## つかいかた
|
||||||
|
|
||||||
|
### Slack アプリの作成
|
||||||
|
|
||||||
|
- Redirect URLs を設定 (例: https://{ホスト名}/ )
|
||||||
|
- Bot Users を設定
|
||||||
|
- (デプロイ後) Event Subscriptions を設定
|
||||||
|
- Request URL を設定 (例: https://{ホスト名}/slack/events )
|
||||||
|
- Bot Events を登録
|
||||||
|
- message.channels (パブリックチャンネルのメッセージをリスニング) など
|
||||||
|
|
||||||
|
### 起動
|
||||||
|
|
||||||
|
次の環境変数を与えてから `yarn && yarn start`
|
||||||
|
|
||||||
|
- `SLACK_BOT_TOKEN` ... OAuth & Permissions ページにあるボット (xoxb) トークン
|
||||||
|
- `SLACK_SIGNING_SECRET` ... Basic Information ページにある Signing Secret
|
||||||
|
- (Optional) `PORT` ... ポート番号。デフォルトは 80。
|
||||||
|
|
||||||
|
### デプロイ
|
||||||
|
|
||||||
|
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/kou029w/daraz-san)
|
15
app.js
Normal file
15
app.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
const { App } = require("@slack/bolt");
|
||||||
|
const patternsOrMiddleware = require("./")
|
||||||
|
|
||||||
|
const app = new App({
|
||||||
|
token: process.env.SLACK_BOT_TOKEN,
|
||||||
|
signingSecret: process.env.SLACK_SIGNING_SECRET
|
||||||
|
});
|
||||||
|
|
||||||
|
app.message(...patternsOrMiddleware);
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await app.start(process.env.PORT || 80);
|
||||||
|
console.log("Daraz-san ⚡ running");
|
||||||
|
})();
|
||||||
|
|
12
app.json
Normal file
12
app.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"SLACK_BOT_TOKEN": {
|
||||||
|
"description": "Slack Bot Token",
|
||||||
|
"value": "xoxb-"
|
||||||
|
},
|
||||||
|
"SLACK_SIGNING_SECRET": {
|
||||||
|
"description": "Slack Signing Secret",
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
index.js
Normal file
6
index.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
module.exports = [
|
||||||
|
"daraz",
|
||||||
|
({ message, say }) => {
|
||||||
|
say(`<@${message.user}>`);
|
||||||
|
}
|
||||||
|
];
|
19
package.json
Normal file
19
package.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "daraz-san",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Daraz-san ⚡",
|
||||||
|
"main": "index.js",
|
||||||
|
"author": "Kohei Watanabe <kou029w@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"start": "node app.js"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@slack/bolt": "^1.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "12.x",
|
||||||
|
"yarn": "1.x"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue