{"id":19603356,"url":"https://github.com/rsify/cactus","last_synced_at":"2025-02-26T15:43:32.803Z","repository":{"id":57192606,"uuid":"79479161","full_name":"rsify/cactus","owner":"rsify","description":"🌵 ts3 helper library for making cool bots","archived":false,"fork":false,"pushed_at":"2017-05-01T12:25:00.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-11T04:48:25.228Z","etag":null,"topics":["bot","javascript","npm","teamspeak3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rsify.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-01-19T17:50:27.000Z","updated_at":"2020-09-19T17:58:08.000Z","dependencies_parsed_at":"2022-08-24T03:10:40.925Z","dependency_job_id":null,"html_url":"https://github.com/rsify/cactus","commit_stats":null,"previous_names":["nikersify/cactus"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsify%2Fcactus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsify%2Fcactus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsify%2Fcactus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsify%2Fcactus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rsify","download_url":"https://codeload.github.com/rsify/cactus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240887200,"owners_count":19873531,"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":["bot","javascript","npm","teamspeak3"],"created_at":"2024-11-11T09:29:15.662Z","updated_at":"2025-02-26T15:43:32.781Z","avatar_url":"https://github.com/rsify.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cactus [![npm](https://img.shields.io/npm/v/cactus-ts.svg)](https://www.npmjs.com/package/cactus-ts)\n\nhelper library for the TeamSpeak 3 [ServerQuery](http://media.teamspeak.com/ts3_literature/TeamSpeak%203%20Server%20Query%20Manual.pdf)\n\n[![travis](https://travis-ci.org/Nikersify/cactus.svg?branch=master)](https://travis-ci.org/Nikersify/cactus)\n\n# example\n\n```javascript\nconst Cactus = require('cactus-ts')\n\nlet bot = new Cactus('hunter1')\n\nbot.on('ready', () =\u003e {\n\tbot.send('sendtextmessage', {\n\t\ttarget: 2,\n\t\ttargetmode: 1,\n\t\tmsg: 'hello world'\n\t}, (res) =\u003e {\n\t\tconsole.log(res)\n\t\t// { err: { id: '0', msg: 'ok' },\n\t\t//   body: \n\t\t//    { notifytextmessage: null,\n\t\t//      targetmode: '1',\n\t\t//      msg: 'hello world',\n\t\t//      target: '2',\n\t\t//      invokerid: '5',\n\t\t//      invokername: 'cactus',\n\t\t//      invokeruid: 'serveradmin' } }\n\t\t// \t})\n})\n```\n\n# usage\n\n## getting started\n\n### `new Cactus(password || options)`\n\nReturns a new instance of `Cactus` and will try to connect to a server, provided that `opts.connect` isn't set to `false`.\n\n#### `options`\n\n- `opts.password` - password used for identification; if you don't know what it is - click [here](https://support.teamspeakusa.com/index.php?/Knowledgebase/Article/View/326/16/how-do-i-change-or-reset-the-password-of-the-serveradmin-server-query-account) **(required)**\n- `opts.login` (default `serveradmin`)\n- `opts.ip` (default `localhost`) - ip to which the client will try to connect to\n- `opts.port` (default `10011`) - same as above\n- `opts.server_number` (default 1) - sets the server index for the `use x` command, leave as default if you don't know what that is\n- `opts.connect` (default `true`) - determines whether the bot should attempt connecting immediately\n- `opts.display_name` (default `Cactus`) - the name that the bot will appear as\n\n## events\nCactus extends your old and loved [EventEmitter](https://nodejs.org/api/events.html), and will emit the following events\n\n### `.on('ready', [callback])` *-\u003e cb()*\nProbably the only one you'll ever need, gets emitted when all the boring stuff is finished and the bot is ready to accept commands.\n\n### `.on('motd', [callback])` *-\u003e cb(msg)*\nEmitted when the server sends out its welcome message, \n\n# methods\n\n### `.connect([ip, [port]])`\nUse this if you have `opts.connect` set to `false`. Attempts to connect to a server at the given address.\n\n### `.send(command, [[[parameters, [[options, [callback])` *-\u003e cb(res)*\n\n```js\nres =\u003e {\n\terr: {id: '0', msg: 'ok'},\n\tbody: {\n\t\tversion: '3.0.0-alpha4',\n\t\tbuild: '9155',\n\t\tplatform: 'Linux'\n\t}\n}\n```\n\nPrepares a nicely escaped `command` with optionals `parameters` and `options`, passes `res` in the given format above to the callback. Refer to the [tests](https://github.com/Nikersify/cactus/blob/master/test/builder.js).\n- `command`#**String** of lowercase letters only, refer to the [pdf](http://media.teamspeak.com/ts3_literature/TeamSpeak%203%20Server%20Query%20Manual.pdf) **(required)**\n- `parameters`#**Object** containing your keys and values\n- `options`#**Array** with different switches for your command --without-- the dash (e.g. `uid`, `away`)\n\nSee the [tests](https://github.com/Nikersify/cactus/blob/master/test/builder.js) for examples of usage.\n\n### `.raw(string, [callback])` *-\u003e cb(res)*\nQueries a raw string of the command to the server, has to be escaped (page 5 in the [pdf](http://media.teamspeak.com/ts3_literature/TeamSpeak%203%20Server%20Query%20Manual.pdf#5)). Passes `res` to the callback.\n\n### `.register(type, [id], [callback])` *-\u003e cb(res)*\nRegisters callbacks to special events emitted by the server, provided that you ask it nicely. `type` depends on the *type* of events you want to register, so `type` is:\n\n- messages\n\t- `private-message` - listen to all private messages sent to the bot, this also includes your own messages that you send to others, so be sure to put a check in place for that.\n\t- `channel-message` - **requires `id`** - get messages in the channel referred to by the `id`\n\t- `server-message` - all messages in the global server channel\n- `client-moved` - **requires `id`** - fires whenether a user switches to, or gets moved into a channel.\n- `client-joined` - listen to clients joining the server, or more specifically your bot's **view,** if you have weird permissions for the SQ on your server.\n- `client-left` - same as above, but with leaving.\n\n# install\n\n`npm install --save cactus-ts`\n\n# license\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsify%2Fcactus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frsify%2Fcactus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsify%2Fcactus/lists"}