From 7bf95e6feec921cd4cccea24c4f1fa3516f54455 Mon Sep 17 00:00:00 2001 From: dlinux-host Date: Mon, 20 Jan 2025 17:14:30 -0500 Subject: [PATCH] Send API KEY as DM --- teamspeak.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/teamspeak.js b/teamspeak.js index d82e569..1c901b0 100644 --- a/teamspeak.js +++ b/teamspeak.js @@ -393,8 +393,14 @@ try { // case "new-api-key": { const newKeyResponse = await makeApiRequest("/new-key", token, client); - const reply = `New API Key: ${newKeyResponse.newAPIKey}`; - await ts3.sendTextMessage(event.target, targetmode, `${senderNickname}, ${reply}`); + try { + // Send a private message to the user to request the token + await client.message( + `New API Key: ${newKeyResponse.newAPIKey}` + ); + } catch (error) { + console.error(`Failed to send DM to ${client.nickname}:`, error); + } break; }