alfred-teamspeak
Teamspeak 3 Bot Framework
Last updated 4 years ago by schroffl .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install alfred-teamspeak 
SYNC missed versions from official npm registry.

Alfred npm version

A Teamspeak 3 Bot Module utilizing the Teamspeak ServerQuery

Installation

$ npm install alfred-teamspeak

Example

const Alfred = require('alfred-teamspeak');
const bot = new Alfred();

bot.login('username', 'password')
	.then(() => console.log('Connected!'))
    .catch(err => console.error(err));
    
bot.on('cliententerview', data => console.log(data.client_nickname, 'connected!'));

Options

Options are passed via an object on construction: new Alfred({ ... })

Name Default Description
name Alfred The name of the bot
host 127.0.0.1 The IP to connect
port 10011 The query port of the server
sid 1 The ID of the Virtual Server

Methods

Alfred.login(username, password)

Login with the specified name and password. Returns a promise which is being resolved on successful login and rejected on failure.

Alfred.send( ... )

Inherited from schroffl/teamspeak-query.

Alfred.set(key, value)

Set a variable.

Alfred.get(key)

Get the value of a variable.
NOTE: After the login you can use Alfred.get('clid') to obtain the ID of the bot.

Alfred.use(event, callback)

Mount the specified callback function to the given event. If event is omitted, the handler will be called for any event.

Middleware

As already said, middleware can be mounted via Alfred.use and may or may not only be used for a specific event such as cliententerview.
Whenever an event occurs, the stack for it will be called with the data the server has given. After the stack has finished, the event will be emitted. So Alfred.on('cliententerview', ...) will be fired when all the middleware has processed the data.
If you want to create your own middleware, take a look at Creating Middleware.
An example can be found here: lib/user.js

User Middleware

Alfred already ships with a package that offers an interface to easily interact with users. You can include like this:

const Alfred = require('alfred-teamspeak');
const User = Alfred.User;

const bot = new Alfred();

bot.use(User);
// [...]

So now if anyting user-related happens, you can respond to the users as easy as:

bot.on('cliententerview', data => data.user.respond('Hello', data.user.get('name')) );

Further documentation of the package can be found here.

Current Tags

  • 4.0.1                                ...           latest (4 years ago)

58 Versions

  • 4.0.1                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.1.3 [deprecated]           ...           5 years ago
  • 2.1.1 [deprecated]           ...           5 years ago
  • 2.1.0 [deprecated]           ...           5 years ago
  • 2.0.0 [deprecated]           ...           5 years ago
  • 1.9.1 [deprecated]           ...           5 years ago
  • 1.9.0 [deprecated]           ...           5 years ago
  • 1.8.0 [deprecated]           ...           5 years ago
  • 1.7.1 [deprecated]           ...           5 years ago
  • 1.7.0 [deprecated]           ...           5 years ago
  • 1.6.5 [deprecated]           ...           5 years ago
  • 1.6.4 [deprecated]           ...           5 years ago
  • 1.6.3 [deprecated]           ...           5 years ago
  • 1.6.2 [deprecated]           ...           5 years ago
  • 1.6.1 [deprecated]           ...           5 years ago
  • 1.6.0 [deprecated]           ...           5 years ago
  • 1.5.6 [deprecated]           ...           5 years ago
  • 1.5.5 [deprecated]           ...           5 years ago
  • 1.5.4 [deprecated]           ...           5 years ago
  • 1.5.3 [deprecated]           ...           5 years ago
  • 1.5.2 [deprecated]           ...           5 years ago
  • 1.5.1 [deprecated]           ...           5 years ago
  • 1.5.0 [deprecated]           ...           5 years ago
  • 1.4.1 [deprecated]           ...           5 years ago
  • 1.4.0 [deprecated]           ...           5 years ago
  • 1.3.0 [deprecated]           ...           5 years ago
  • 1.2.10 [deprecated]           ...           5 years ago
  • 1.2.9 [deprecated]           ...           5 years ago
  • 1.2.8 [deprecated]           ...           5 years ago
  • 1.2.7 [deprecated]           ...           5 years ago
  • 1.2.6 [deprecated]           ...           5 years ago
  • 1.2.5 [deprecated]           ...           5 years ago
  • 1.2.4 [deprecated]           ...           5 years ago
  • 1.2.3 [deprecated]           ...           5 years ago
  • 1.2.2 [deprecated]           ...           5 years ago
  • 1.2.1 [deprecated]           ...           5 years ago
  • 1.2.0 [deprecated]           ...           5 years ago
  • 1.1.4 [deprecated]           ...           5 years ago
  • 1.1.3 [deprecated]           ...           5 years ago
  • 1.1.2 [deprecated]           ...           5 years ago
  • 1.1.1 [deprecated]           ...           5 years ago
  • 1.1.0 [deprecated]           ...           5 years ago
  • 1.0.12 [deprecated]           ...           5 years ago
  • 1.0.11 [deprecated]           ...           5 years ago
  • 1.0.10 [deprecated]           ...           5 years ago
  • 1.0.9 [deprecated]           ...           5 years ago
  • 1.0.8 [deprecated]           ...           5 years ago
  • 1.0.7 [deprecated]           ...           5 years ago
  • 1.0.6 [deprecated]           ...           5 years ago
  • 1.0.5 [deprecated]           ...           5 years ago
  • 1.0.4 [deprecated]           ...           5 years ago
  • 1.0.3 [deprecated]           ...           5 years ago
  • 1.0.2 [deprecated]           ...           5 years ago
  • 1.0.1 [deprecated]           ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2016 © taobao.org |