# teeworlds-econ

> Teeworlds external console

Latest version **1.3.4** (published 2016-10-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install teeworlds-econ
pnpm add teeworlds-econ
yarn add teeworlds-econ
bun add teeworlds-econ
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.4 |
| Published | 2016-10-21 |
| First published | 2016-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Black Roland |
| Maintainers | black-roland |
| Keywords | teeworlds |

## Links

- npm: https://www.npmjs.com/package/teeworlds-econ
- Repository: https://github.com/chuck-norris-network/teeworlds-econ-js
- Homepage: https://github.com/chuck-norris-network/teeworlds-econ-js#readme
- Issues: https://github.com/chuck-norris-network/teeworlds-econ-js/issues
- npm.io page: https://npm.io/package/teeworlds-econ

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^2.2.0
- [split](https://npm.io/package/split.md) ^1.0.0
- [split-text](https://npm.io/package/split-text.md) ^1.0.0

## Recent versions

- 1.3.4 (latest) — 2016-10-21
- 1.3.3 — 2016-10-21
- 1.3.2 — 2016-10-19
- 1.3.1 — 2016-09-19
- 1.3.0 — 2016-09-14
- 1.2.2 — 2016-08-12
- 1.2.1 — 2016-07-10
- 1.2.0 — 2016-05-07
- 1.1.3 — 2016-05-02
- 1.1.2 — 2016-05-02
- 1.1.1 — 2016-05-01
- 1.1.0 — 2016-05-01
- 1.0.0 — 2016-05-01

## README

# Teeworlds External Console

[![NPM version][npm-image]][npm-url] ![License][license-image]

Teeworlds external console client.

## Installation

Install via npm:

```sh
npm install --save teeworlds-econ
```

Configure Teeworlds external console:

```
ec_port         8303
ec_password     secret
ec_output_level 2
```

## Usage

### Initialize and connect

```js
const TeeworldsEcon = require('teeworlds-econ');

const host = 'localhost'
const port = 8303
const password = 'secret'

const econ = new TeeworldsEcon(host, port, password);

econ.on('online', (err) => {
  console.log('Connected');
});

econ.on('error', (err) => {
  console.error('%s error: %s', err.name, err.message);
});

econ.connect();
```

## Handling game events

```js
econ.on('enter', (e) => {
  console.log('%s (%s) has entered the %s', e.player, e.client, e.team);
});

econ.on('leave', (e) => {
  console.log('%s has left the game', e.player);
});

econ.on('chat', (e) => {
  console.log('%s: "%s"', e.player, e.message);
});

econ.on('pickup', (e) => {
  console.log('%s picked up %s', e.player, e.weapon);
});

econ.on('kill', (e) => {
  console.log('%s killed %s with %s', e.killer, e.victim, e.weapon);
});
```

## Commands

```js
econ.say('gg'); // Send message to chat
econ.svMotd('Welcome!'); // Set message of the day
econ.status().then((status) => { // Fetch players list
  console.log(status);
});
econ.exec('sv_map dm2').then(() => { // Change current map to dm2
  console.log('Map changed');
});
```

## All supported game events

- `enter { player, team, client }`
- `leave { player, client }`
- `pickup { player, weapon, client }`
- `chat { type, player, message, team, client }`
- `kill { killer, victim, weapon, killerClient, victimClient }`
- `flaggrab { player, client }`
- `flagreturn {}`
- `capture { player, client }`
- `netban { ip, reason, minutes, life }`

## License

MIT

[npm-image]: https://img.shields.io/npm/v/teeworlds-econ.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/teeworlds-econ
[license-image]: https://img.shields.io/npm/l/teeworlds-econ.svg?style=flat-square

---
_Source: https://npm.io/package/teeworlds-econ · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
