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; }