Examples

Practical snippets showing common tasks with teamspeak.js.

Code Examples

Explore focused examples for common TeamSpeak tasks using teamspeak.js.

Boilerplate Setup
Query setup you can reuse across examples.
bootstrap.ts
// This is the default setup for all examples.
            
// It's for TeamSpeak 3! For TeamSpeak 6,
// use the SSH protocol instead (https://teamspeak.js.org/examples/teamspeak-6-server/).
            
import { Query } from 'teamspeak.js';

const query = new Query({ host: '127.0.0.1' });

await query.connect();

await query.login('serveradmin', 'p4ssw0rd');

await query.virtualServers.use(1);