Merge branch 'master' into 'master'
update README.md update README.md See merge request !10
Showing
2 changed files
with
23 additions
and
10 deletions
| 1 | ## SOCKET SERVER | 1 | ## SOCKET SERVER |
| 2 | 2 | ||
| 3 | -> TMI client (twitch chat socket server)와 socket서버를 연결하여 front에게 채팅/번역된 채팅을 emit해주는 서버 | 3 | +> TMI client (twitch chat socket server)와 socket서버를 연결하여 front에게 해당 스트리머 채널의 채팅/번역된 채팅을 emit해주는 서버 |
| 4 | 4 | ||
| 5 | ## 현재 개발상태 | 5 | ## 현재 개발상태 |
| 6 | 6 | ||
| 7 | > nodejs서버와 테스트용으로 만든 ejs를 결합. | 7 | > nodejs서버와 테스트용으로 만든 ejs를 결합. |
| 8 | > papago API와 연동하여 챗이 emit하면 한국어인지 판단하고 해당 room에 번역된 채팅을 뿌려줌 | 8 | > papago API와 연동하여 챗이 emit하면 한국어인지 판단하고 해당 room에 번역된 채팅을 뿌려줌 |
| 9 | +> twitch bachelorchuckchuck, nonnu 의 방송에 example로 연결. | ||
| 10 | +> localhost/:{env.SOCKET_PORT} 에서 해당 채팅방의 내용을 socket에 연결된 front(현재는 test ejs)로 뿌려줌 | ||
| 9 | 11 | ||
| 10 | ## 실행방법 | 12 | ## 실행방법 |
| 11 | 13 | ||
| 12 | >.env파일을 만듭니다. | 14 | >.env파일을 만듭니다. |
| 13 | 15 | ||
| 16 | +**/server/env** | ||
| 17 | +```txt | ||
| 18 | + SOCKET_PORT= | ||
| 19 | + TOKEN= | ||
| 20 | + PAPAGO_ID= | ||
| 21 | + PAPAGO_SECRET= | ||
| 22 | + BOT_USERNAME= | ||
| 23 | + OAUTH_TOKEN= | ||
| 14 | ``` | 24 | ``` |
| 15 | - cd server | 25 | + |
| 16 | - npm install pkg.json --save | 26 | +```bash |
| 17 | - npm start | 27 | + $cd server |
| 28 | + $npm install pkg.json --save | ||
| 29 | + $npm start | ||
| 18 | ``` | 30 | ``` |
| 19 | 31 | ||
| 32 | +> localhost/:{env.SOCKET_PORT} 에서 결과 확인 | ||
| 33 | + | ... | ... |
| ... | @@ -86,12 +86,11 @@ client.connect(); | ... | @@ -86,12 +86,11 @@ client.connect(); |
| 86 | function onMessageHandler (target, context, msg, self) { | 86 | function onMessageHandler (target, context, msg, self) { |
| 87 | if (self) { return; } // Ignore messages from the bot | 87 | if (self) { return; } // Ignore messages from the bot |
| 88 | 88 | ||
| 89 | - io.to(target.replace('#','')).emit('chat message',context["display-name"],msg) | 89 | + if (msg.startsWith('!')){ |
| 90 | - papago.detectchat(msg, client, io, target); | 90 | + } |
| 91 | - | 91 | + else{ |
| 92 | - | 92 | + io.to(target.replace('#','')).emit('chat message',context["display-name"],msg) |
| 93 | - if(msg == '척척학사2'){ | 93 | + papago.detectchat(msg, client, io, target); |
| 94 | - client.say(target, `안녕하세요 척척학사의 방송입니다.`); | ||
| 95 | } | 94 | } |
| 96 | 95 | ||
| 97 | } | 96 | } | ... | ... |
-
Please register or login to post a comment