diff --git a/build.sh b/build.sh index dac278a..7fa3546 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,5 @@ +#!/bin/sh + mkdir build cd main-web/client npm run build @@ -8,8 +10,18 @@ npm run build cd ../../ mv tools/janken/tool build cd main-web/server +export catherine_db_user=$(aws --region=ap-northeast-1 ssm get-parameter --name "db-username" --with-decryption --output text --query Parameter.Value) +export catherine_db_pass=$(aws --region=ap-northeast-1 ssm get-parameter --name "db-password" --with-decryption --output text --query Parameter.Value) +cat > .env < = {}; const players: Record = {}; const connection = mysql.createPool({ connectionLimit: 10, - host: 'test-db.csmrqtei38qi.ap-northeast-1.rds.amazonaws.com', - user: 'admin', - password: '12341234', + host: 'catherine-fc.csmrqtei38qi.ap-northeast-1.rds.amazonaws.com', + user: process.env.DB_USER, + password: process.env.DB_PASS, database: 'catherine_league' }); connection.query( diff --git a/tools/discord-commentator/package.json b/tools/discord-commentator/package.json index dd39018..d66cef0 100644 --- a/tools/discord-commentator/package.json +++ b/tools/discord-commentator/package.json @@ -3,6 +3,13 @@ "version": "0.1.0", "private": true, "dependencies": { + "discord-rpc": "^3.1.3", + "react": "^16.13.1", + "react-dom": "^16.13.1", + "react-scripts": "3.4.1", + "typescript": "^3.7.5" + }, + "devDependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", @@ -10,10 +17,7 @@ "@types/node": "^12.12.54", "@types/react": "^16.9.44", "@types/react-dom": "^16.9.8", - "react": "^16.13.1", - "react-dom": "^16.13.1", - "react-scripts": "3.4.1", - "typescript": "^3.7.5" + "@types/discord-rpc": "^3.0.4" }, "scripts": { "start": "react-scripts start", diff --git a/tools/discord-commentator/src/App.tsx b/tools/discord-commentator/src/App.tsx index a53698a..2a7807f 100644 --- a/tools/discord-commentator/src/App.tsx +++ b/tools/discord-commentator/src/App.tsx @@ -1,8 +1,25 @@ import React from 'react'; import logo from './logo.svg'; import './App.css'; - -function App() { +import RPC from 'discord-rpc'; +function App(): JSX.Element { + let client: any = null; + const clientId = '207646673902501888'; + const scopes = ['rpc', 'rpc.api', 'messages.read']; + if (client === null) { + client = new RPC.Client({ transport: 'websocket' }); + if (client) { + client.on('ready', () => { + if (client) { + console.log('Logged in as', client.application.name); + console.log('Authed for user', client.user.username); + client.selectVoiceChannel('740735736361517137'); + } + }); + // Log in to RPC with client id + client.login({ clientId, scopes }); + } + } return (
diff --git a/tools/discord-commentator/src/index.tsx b/tools/discord-commentator/src/index.tsx index f5185c1..9ebacb4 100644 --- a/tools/discord-commentator/src/index.tsx +++ b/tools/discord-commentator/src/index.tsx @@ -5,9 +5,11 @@ import App from './App'; import * as serviceWorker from './serviceWorker'; ReactDOM.render( - - - , + ( + + + + ), document.getElementById('root') );