{"id":17154717,"url":"https://github.com/antoine-pous/node-teamspeak3-client","last_synced_at":"2026-03-15T15:20:54.834Z","repository":{"id":57167978,"uuid":"90789729","full_name":"antoine-pous/node-teamspeak3-client","owner":"antoine-pous","description":"😱 A TeamSpeak3 ServerQuery client with anti-ban feature, prepared statements and a lot of cool stuffs","archived":false,"fork":false,"pushed_at":"2018-01-30T22:32:53.000Z","size":72,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"v3","last_synced_at":"2025-03-27T04:12:06.368Z","etag":null,"topics":["client-library","nodejs-modules","serverquery","teamspeak3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antoine-pous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-09T20:38:48.000Z","updated_at":"2021-03-07T19:59:09.000Z","dependencies_parsed_at":"2022-08-30T13:20:28.387Z","dependency_job_id":null,"html_url":"https://github.com/antoine-pous/node-teamspeak3-client","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoine-pous%2Fnode-teamspeak3-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoine-pous%2Fnode-teamspeak3-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoine-pous%2Fnode-teamspeak3-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antoine-pous%2Fnode-teamspeak3-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antoine-pous","download_url":"https://codeload.github.com/antoine-pous/node-teamspeak3-client/tar.gz/refs/heads/v3","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717241,"owners_count":21150389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-library","nodejs-modules","serverquery","teamspeak3"],"created_at":"2024-10-14T21:49:50.185Z","updated_at":"2026-03-15T15:20:49.790Z","avatar_url":"https://github.com/antoine-pous.png","language":"JavaScript","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=MAKZLQGRSBCT2"],"categories":[],"sub_categories":[],"readme":"# TeamSpeak 3 TypeScript ServerQuery Client\n\n[![Build Status](https://travis-ci.org/antoine-pous/node-teamspeak3-client.svg?branch=master)](https://travis-ci.org/antoine-pous/node-teamspeak3-client)\n[![Dependency Status](https://gemnasium.com/badges/github.com/antoine-pous/node-teamspeak3-client.svg)](https://gemnasium.com/github.com/antoine-pous/node-teamspeak3-client)\n![](https://img.shields.io/badge/TS3_server_version-3.0.13.8-blue.svg)\n[![Donate](https://img.shields.io/badge/%E2%99%A5-donate-459042.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=MAKZLQGRSBCT2)\n\nThis client is designed to help you to create your own application wich need to communicate with the TeamSpeak 3 Server through the ServerQuery API.\n\n## Installation\n```console\n$ npm install @ts3/query-client --save\n```\n\n## Introduction\nSince the version 3, the client do not use anymore the callback and implement exclusively the promises. \n\nPromises are resolved when the error ID is equal to 0 and rejected when the error ID is equal or greater than 1.\n\nPromises resolved without received data from the server return true, if the promise return data it's always in an Array.\n\n### Events\nThe client emit a lot of events, they allow you to debug and write your logfiles as you want.\n\n| Event name | Arguments | Description\n---|---|---\ninfo | {string} msg | Give info message\nerror | {iError} err | Error object wich contain the `id`, the `msg` and the `query`.\nwarn | {string} msg | Warning messages are emitted when you update some sensitive features.\nconnect | `none` | [See Net Event connect](https://nodejs.org/api/net.html#net_event_connect)\nend | `none` | [See Net Event end](https://nodejs.org/api/net.html#net_event_end)\nclose | `none` | [See Net Event close](https://nodejs.org/api/net.html#net_event_close)\n\n### Interfaces\nSome interfaces are available to type your data, you can load them from `@ts3/query-client/interfaces`\n\n### Errors\nErrors are provided with 3 parameters:\n\n- {number} `id`: The error ID, if the error comes from the socket the ID is always `9000`\n- {string} `msg`: The error message\n- {string} `query`: The query which occur the error\n\n**Note**: The query is not available when the error is not occurred by a query.\n\n### Data\nThe data are always given when the promise is resolved, this is always an object wich contains these informations:\n\n```typescript\n{\n    query: {\n        id: number,\n        query: string\n    },\n    data: [{..row1..}, {..row2..}] \n}\n```\n\n##### TODO\nThis client is a work in progress, i have some ideas to implement when i had the time :\n- Interfaces for each kind of data\n- Attach an event name on query\n- Each server command as a method\n- Implement filetransfert methods and interfaces\n- Units tests\n\nFeel free to open a pull request to improve the client.\n\n#### Anti Flood\nThe client is provided with an anti-flood feature, when the client connect to the serverinstance it get the `instanceinfo` properties.\n\nIf these informations are not available the client use the default values. You can enforce theses values, ask your hoster about the flood rate \nlimit if you are banned with the default values.\n\n// TODO explain methods and interface\n\nIf your client is whitelisted you can disable this feature.\n\n#### .connect\nConnect the QueryClient to the TS3 server, the event `connect` is emitted when the QueryClient is successfully connected to the server.\n\n```typescript\nimport TS3QueryClient from \"@ts3/query-client\";\nimport {iError} from \"@ts3/query-client/interfaces\";\n\n\n(async () =\u003e {\n    \n    let TS3Client = new TS3QueryClient();\n    \n    // Connect to the server\n    let connected = await TS3Client.connect(\"127.0.0.1\", 10011).catch((err: iError) =\u003e {\n        \n        if(err.id \u003e 0) {\n            console.log(err.id, err.msg);\n            process.exit(1); // Connection failed, kill the process\n        }\n    \n    });\n    \n});\n```\n\n#### Build and send your query\nYou can build and escape your queries easily. If you want send the query in priority you can use `queryNow`.\n\n```typescript\nTS3Client.query('serveredit', {virtualserver_name:'TeamSpeak ]|[ Server'}, []).then(\n    (renamed: boolean) =\u003e { // serveredit don't return data, get true when the query is resolved\n       if(renamed)\n           console.log(\"Virtualserver name edited!\");\n    },\n    (err: iError) =\u003e {\n\n        // If the server return an error\n        if(err.id \u003e 0)\n            // do the stuff\n      \n    }\n);\n```\n\n#### Send query\nIf you need you can send raw queries, they are **not** escaped. If you want send the query in priority you can use `sendNow`.\n```js\nlet clientlist = await TS3Client.send(`clientlist`).catch((err: iError) =\u003e {\n\n  // If the server return an error\n  if(err.id \u003e 0)\n      // do the stuff\n});\n\nif(clientlist.data.length \u003e 0)\n    // Perform treatment on the clientlist\n```\n\n#### Prepared queries\nFor more efficience you can set a lots of prepared querie, this is a good way to reuse the same queries \nin many places with differents values.\n\nIf you want execute the query in priority you can use `executeNow`.\n\n**Note:** You must respect the arguments list order used in your query\n```js\n// Prepare the queries\nTS3Client.prepare('serverEdit', 'serveredit virtualserver_name=%s virtualserver_password=%s');\nTS3Client.prepare('setVServerMaxClients', 'serveredit virtualserver_maxclients=%d');\n\n// Execute the query, the values are escaped using teamspeak3-utils\nTS3Client.execute('serveredit', ['TeamSpeak ]|[ Server', 'newPassword']).catch((err) =\u003e {\n\n  // If the server return an error\n  if(err.id \u003e 0) throw new Error(err.msg);\n\n  console.log(rows)\n  // Do the stuff...\n});\n\nTS3Client.execute('setVServerMaxClients', ['numbers expected']);\n```\n\n#### Upload a file\n**Note** This feature is currently in testing phase, report any encoutered problems.\n\nYou can upload a file through the TeamSpeak 3 File Transfert Manager with the method `.uploadFile`.\n\nParameters are :\n\n* {Required} src *Local file path*\n* {Required} dest *File path into the channel directory*\n* {Required} cid *Channel ID*\n* {Required} overwrite *Overwrite existing file*\n* {Required} resume *Resume the upload*\n* {Optionnal} cpw *Channel password*\n\n```typescript\nlet isUploaded = TS3Client.uploadFile(src, dest, cid, overwrite, resume, cpw).catch((e: iError) =\u003e {\n    console.log(e.id, e.msg);\n});\n\nif(isUploaded)\n    console.log('File uploaded!');\n```\n\n### TeamSpeak 3 Query Utilities\nThe client use the `@ts3/query-utils` package, so you can import it in your application.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoine-pous%2Fnode-teamspeak3-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoine-pous%2Fnode-teamspeak3-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoine-pous%2Fnode-teamspeak3-client/lists"}