mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
Add client poking (send and receive)
Uses tsclientlib's existing MessageTarget::Poke support end to end: a poke button on each client row opens a small compose overlay (an optional message, like TeamSpeak's own poke), and incoming pokes show as a dismissible, auto-expiring banner. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
76cb90360c
commit
ec034d2d6b
5 files changed
+214
-2
No files matched your search
@@ -42,6 +42,10 @@ wss.on("connection", (socket: WebSocket) => {
|
||||
await connection?.sendPrivateMessage(msg.clientId, msg.message);
|
||||
break;
|
||||
}
|
||||
case "sendPoke": {
|
||||
await connection?.sendPoke(msg.clientId, msg.message ?? "");
|
||||
break;
|
||||
}
|
||||
case "sendAudio": {
|
||||
await connection?.sendAudio(msg.pcm);
|
||||
break;
|
||||
|
||||
@@ -34,6 +34,7 @@ export type Ts3ConnectionEvent =
|
||||
| { type: "chatMessage"; from: string; message: string }
|
||||
| { type: "serverMessage"; from: string; message: string }
|
||||
| { type: "privateMessage"; partnerId: number; partnerName: string; fromSelf: boolean; message: string }
|
||||
| { type: "poke"; from: string; message: string }
|
||||
| { type: "audioOut"; pcm: string }
|
||||
| { type: "talkers"; clients: number[] }
|
||||
| { type: "disconnected"; reason: string }
|
||||
@@ -92,6 +93,7 @@ export class Ts3Connection {
|
||||
| { type: "chatMessage"; from: string; message: string }
|
||||
| { type: "serverMessage"; from: string; message: string }
|
||||
| { type: "privateMessage"; partner_id: number; partner_name: string; from_self: boolean; message: string }
|
||||
| { type: "poke"; from: string; message: string }
|
||||
| { type: "audioOut"; pcm: string }
|
||||
| { type: "talkers"; clients: number[] }
|
||||
| { type: "disconnected"; reason: string }
|
||||
@@ -162,6 +164,11 @@ export class Ts3Connection {
|
||||
if (sanitized) this.child?.stdin.write(`pm ${clientId} ${sanitized}\n`);
|
||||
}
|
||||
|
||||
async sendPoke(clientId: number, message: string): Promise<void> {
|
||||
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
|
||||
this.child?.stdin.write(`poke ${clientId} ${sanitized}\n`);
|
||||
}
|
||||
|
||||
async sendAudio(pcmBase64: string): Promise<void> {
|
||||
this.child?.stdin.write(`audio ${pcmBase64}\n`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user