diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7af7f04 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules +.env \ No newline at end of file diff --git a/README.md b/README.md index 4eeb858..d98d5f6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,34 @@ # scramble_bot + + + + discord bot for team scramble + +## Installation +--- +1. Clone scramble_bot repository +```shell +$ git clone https://github.com/TeamScramble/scramble_bot.git +``` +2. move to scramble_bot directory +```shell +$ cd /scramble_bot +``` + +3. Install dependecies +```shell +$ npm install +``` + +## Deploy +--- +1. compress files to zip +2. Login to AWS console +3. Move to AWS Lambda +4. Make your own lambda function and upload the zip file to it +5. Test uploaded function in AWS Lambda +6. Add your own Trigger with AWS EventBridge +7. Enjoy your Lambda function! + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..da3af0f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,26 @@ +{ + "name": "scramble_bot", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, + "dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + }, + "follow-redirects": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.2.tgz", + "integrity": "sha512-yLR6WaE2lbF0x4K2qE2p9PEXKLDjUjnR/xmjS3wHAYxtlsI9MLLBJUZirAHKzUZDGLxje7w/cXR49WOUo4rbsA==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..8884e72 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "scramble_bot", + "version": "1.0.0", + "description": "discord bot for team scramble", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/TeamScramble/scramble_bot.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/TeamScramble/scramble_bot/issues" + }, + "homepage": "https://github.com/TeamScramble/scramble_bot#readme", + "dependencies": { + "axios": "^0.21.1", + "dotenv": "^10.0.0" + } +} diff --git a/src/dailyScrum.js b/src/dailyScrum.js new file mode 100644 index 0000000..580611f --- /dev/null +++ b/src/dailyScrum.js @@ -0,0 +1,24 @@ +const axios = require("axios"); +require('dotenv').config(); + + +exports.handler = async (event) => { + + try { + const result = await axios.post(process.env.DAILYSCRUM_URL, { + "content": "안뇽 :wave: 데일리 스크럼을 해주세요! \n :white_check_mark: 체크인: \n :white_check_mark: 해야할 일: \n :white_check_mark: 협업할 일: \n :white_check_mark: 논의할 일: " + }) + console.info("디스코드 웹훅 전송 성공!") + } + catch(err){ + console.err("웹훅 실패", err) + } + + // TODO implement + const response = { + statusCode: 200, + body: JSON.stringify('daily scrum message from Lambda!'), + }; + + return response; +};