mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 08:41:39 +01:00
minor changes/fixes
This commit is contained in:
@@ -33,12 +33,11 @@ const server = Bun.serve({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
websocket: {
|
websocket: {
|
||||||
open(ws) {
|
open(_ws) {
|
||||||
logger.ok('Opened websocket connection to chatwidget');
|
sendTwitchEvent({
|
||||||
ws.sendText(JSON.stringify({
|
|
||||||
function: 'serverNotification',
|
function: 'serverNotification',
|
||||||
message: 'Sucessfully opened websocket connection'
|
message: 'Sucessfully opened websocket connection'
|
||||||
}));
|
});
|
||||||
},
|
},
|
||||||
message(ws, omessage) {
|
message(ws, omessage) {
|
||||||
const message = JSON.parse(omessage.toString());
|
const message = JSON.parse(omessage.toString());
|
||||||
@@ -47,10 +46,10 @@ const server = Bun.serve({
|
|||||||
case 'subscribe':
|
case 'subscribe':
|
||||||
if (!message.target) return;
|
if (!message.target) return;
|
||||||
ws.subscribe(message.target);
|
ws.subscribe(message.target);
|
||||||
ws.send(JSON.stringify({
|
sendTwitchEvent({
|
||||||
function: 'serverNotification',
|
function: 'serverNotification',
|
||||||
message: `Successfully subscribed to all ${message.target} events`
|
message: `Successfully subscribed to all ${message.target} events`
|
||||||
}));
|
});
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -58,7 +57,11 @@ const server = Bun.serve({
|
|||||||
ws.close();
|
ws.close();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
development: true
|
development: false,
|
||||||
|
error(error) {
|
||||||
|
logger.err(`Error at chatwidget server: ${error}`);
|
||||||
|
return new Response("Internal Server Error", { status: 500 })
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function sendTwitchEvent(event: twitchEventData) {
|
export async function sendTwitchEvent(event: twitchEventData) {
|
||||||
|
|||||||
Reference in New Issue
Block a user