mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-14 14:48:44 +02:00
22 lines
624 B
TypeScript
22 lines
624 B
TypeScript
|
// messageHandlers/chat.ts
|
||
|
import { MessageHandler } from "../ws";
|
||
|
|
||
|
export const handleNewtMessage: MessageHandler = async (context) => {
|
||
|
const { message, senderNewtId, sendToClient } = context;
|
||
|
|
||
|
// Process chat message
|
||
|
// ... your chat logic here ...
|
||
|
|
||
|
// Example response
|
||
|
return {
|
||
|
message: {
|
||
|
type: 'newt_response',
|
||
|
data: {
|
||
|
originalMessage: message.data,
|
||
|
timestamp: new Date().toISOString()
|
||
|
}
|
||
|
},
|
||
|
broadcast: false, // Send to all clients
|
||
|
excludeSender: false // Include sender in broadcast
|
||
|
};
|
||
|
};
|