A work-in-progress chat bot for Streamplace with chat overlay functionality
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Overlay available for all streamers again

+20 -20
+2 -2
TODO.md
··· 1 1 TODOs: 2 2 3 - - [ ] thanking for follows only when live 4 - - [ ] making chat overlay available to all users again 3 + - [X] thanking for follows only when live 4 + - [X] making chat overlay available to all users again 5 5 - [ ] refactoring/cleaner file structure 6 6 - [X] README.md 7 7 - [ ] VIP & event badges
+18 -18
utils/eventHandler.ts
··· 117 117 const record = event.commit.record as PlaceStreamChatMessage.Main; 118 118 if (botInstances.has(record.streamer)) { 119 119 // Send to bot 120 - const streamplaceBot = botInstances.get(record.streamer); 121 - streamplaceBot!.processMessage(event); 122 - // Enrich and pass to subscribed websocket clients 123 - const subscribedClients = this.streamerClients.get( 120 + const streamplaceBot = botInstances.get(record.streamer)!; 121 + streamplaceBot.processMessage(event); 122 + } 123 + // Enrich and pass to subscribed websocket clients 124 + const subscribedClients = this.streamerClients.get( 125 + record.streamer, 126 + ); 127 + if (subscribedClients && subscribedClients.size > 0) { 128 + const enrichedMessage = await this.enrichMessage( 124 129 record.streamer, 130 + event, 125 131 ); 126 - if (subscribedClients && subscribedClients.size > 0) { 127 - const enrichedMessage = await this.enrichMessage( 128 - record.streamer, 129 - event, 130 - ); 131 - const messageJson = JSON.stringify({ 132 - type: "chat_message", 133 - data: enrichedMessage, 134 - }); 132 + const messageJson = JSON.stringify({ 133 + type: "chat_message", 134 + data: enrichedMessage, 135 + }); 135 136 136 - // Send to all subscribed clients 137 - for (const client of subscribedClients) { 138 - if (client.readyState === WebSocket.OPEN) { 139 - client.send(messageJson); 140 - } 137 + // Send to all subscribed clients 138 + for (const client of subscribedClients) { 139 + if (client.readyState === WebSocket.OPEN) { 140 + client.send(messageJson); 141 141 } 142 142 } 143 143 }