Jinsu Park

2차 통합 완료

......@@ -3,7 +3,8 @@ import Login from "./Login";
import Body from "./Body";
function App() {
let accessToken = null;
// let accessToken = null;
let accessToken = 1;
return (
<div className="app">
......
......@@ -8,7 +8,7 @@ import { WatchOutlined } from "@material-ui/icons";
import io from 'socket.io-client'
import tts from './tts';
const socket = io.connect("http://localhost:3000")
const socket = io.connect("http://localhost:3303")
socket.on("connect", event=>{
// 테스트용으로 umi0410에게 입장.
// 다른 거 아무거나 채널이름을 넣으면 되겠지만, 그렇게 하고싶으면 백엔드에서 인자설정을 해줘야함.
......@@ -18,6 +18,7 @@ socket.on("connect", event=>{
// 말해야할 메시지가 왔을 때. 이건 따로 Component와 묶지 않아도 알아서 실행됩니다.
socket.on('chat message', (name, msg)=>{
console.log(msg)
console.log("got message")
tts.speak(msg)
})
......
import React from "react";
import "./Login.css";
function Login(){
const OAuthUrl = ""; // oauth 인증용 url
function Login(){
const OAuthUrl = `https://id.twitch.tv/oauth2/authorize?response_type=code&approval_prompt=auto&redirect_uri=http://localhost:3303/join&client_id=2d1gvcqyiyrk180qvnkec2fl23sv1o`; // oauth 인증용 url
return (
<div className="login">
<img
......
......@@ -52,7 +52,7 @@ app.post('/jointest',async (req,res)=>{
JoinChannel(req.body.streamer);
res.send(req.body.streamer)
});
console.log(`https://id.twitch.tv/oauth2/authorize?response_type=code&approval_prompt=auto&redirect_uri=${process.env.HOST_URI+':'+process.env.SOCKET_PORT}/join&client_id=${process.env.TWITCH_CLIENT}`)
////////////////////////oauth////////////////////////
const axios = require('axios')
app.get('/oauth',(req,res)=>{
......@@ -72,7 +72,7 @@ app.get('/join', async (req,res)=>{
}
).then(resp2=>{
JoinChannel(resp2.data.login)
res.send("Joinned "+resp2.data.login)
res.redirect("http://localhost:8000?authenticated=true") // 이거 프론트 유알엘임
})
})
......@@ -147,7 +147,8 @@ function onMessageHandler (target, context, msg, self) {
}
else if(context["display-name"] == "빵_떡"
|| context["display-name"]=="Nightbot"
|| context["display-name"]=="싹뚝"){
|| context["display-name"]=="싹뚝"
|| context["display-name"]=="KhuwitchBot"){
return;
}
else{
......