Jinsu Park

Fix: errors

......@@ -11,11 +11,11 @@ import tts from './tts';
// audioQueue에서 하나씩 뽑아서 재생한다.
tts.enableAudio()
const socket = io.connect(`http://server.oss.jinsu.me`)
const socket = io.connect("http://server.oss.jinsu.me")
socket.on("connect", event=>{
// 테스트용으로 umi0410에게 입장.
// 다른 거 아무거나 채널이름을 넣으면 되겠지만, 그렇게 하고싶으면 백엔드에서 인자설정을 해줘야함.
socket.emit("joinRoom", 'umi0410', '진수봇')
// socket.emit("joinRoom", 'umi0410', '진수봇')
})
// 말해야할 메시지가 왔을 때. 이건 따로 Component와 묶지 않아도 알아서 실행됩니다.
......@@ -101,6 +101,7 @@ export class ChannelList extends React.Component {
channels[index].isPlay = true;
// 기존 채널 재생을 중지하고 새로운 채널을 listen
console.log("if")
quit(channels[this.state.xisPlaying].id);
listen(channels[index].id);
}
......@@ -109,6 +110,7 @@ export class ChannelList extends React.Component {
else {
channels[index].isPlay = true;
// 채널 listen
console.log("else")
listen(channels[index].id);
}
......@@ -121,13 +123,13 @@ export class ChannelList extends React.Component {
componentDidMount() {
console.log('channel cdm');
fetch(`http://server.oss.jinsu.me/channels`).then( res => res.json())
fetch('http://server.oss.jinsu.me/channels').then( res => res.json())
.then(data => {
var tmpChannels = [];
data.map((channel, index) => {
var tmp = {
id: channel.display_name || " ",
nickname: channel.name || " ",
id: channel.name|| " ",
nickname: channel.display_name || " ",
category: channel.game || "Not playing",
view: channel.views || 0,
url: channel.url || "https://www.twitch.tv/",
......
......@@ -38,7 +38,7 @@ app.get('/', (req, res) => {
});
app.get('/channels',(req,res) => {
//console.log(channels)
console.log(channels)
res.send(channels)
});
......@@ -91,11 +91,10 @@ app.get('/test',(req,res)=>{
////////////////////////oauth////////////////////////
async function JoinChannel(streamer){
await client.action(streamer,'KhuwitchBot 두두등장');
await opts.channels.push('#'+streamer);
await delete client;
async function JoinChannel(streamer){
opts.channels = [('#'+streamer)]
client = await new tmi.client(opts);
client.channels.push('#'+streamer);
client.on('message', onMessageHandler);
client.on('connected', onConnectedHandler);
client.connect();
......@@ -123,6 +122,7 @@ io.on('connection', (socket) => {
});
socket.on('chat message', (streamer, name, msg) => {
io.to(streamer).emit('chat message', name, msg);
});
});
......@@ -160,6 +160,7 @@ function onMessageHandler (target, context, msg, self) {
}
else{
io.to(target.replace('#','')).emit('chat message',context["display-name"],msg)
console.log("메시지 발생", context["display-name"],msg)
papago.detectchat(msg, client, io, target);
}
......