# shotwars-js

> The ShotWars.io API for bots

Latest version **1.0.0** (published 2023-10-17) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install shotwars-js
pnpm add shotwars-js
yarn add shotwars-js
bun add shotwars-js
```

## 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.0.0 |
| Published | 2023-10-17 |
| First published | 2023-10-17 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 51.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | scar17off |
| Maintainers | scar17off |
| Keywords | shotwars, shotwars.io, shotwars-js |

## Links

- npm: https://www.npmjs.com/package/shotwars-js
- Repository: https://github.com/scar17off/shotwars-js
- Homepage: https://github.com/scar17off/shotwars-js#readme
- Issues: https://github.com/scar17off/shotwars-js/issues
- npm.io page: https://npm.io/package/shotwars-js

## Recent versions

- 1.0.0 (latest) — 2023-10-17

## README

# shotwars-js
Node.js library for [ShotWars.IO](https://shotwars.io/ "ShotWars.IO").

Installing: `npm i shotwars-js`.\
**REQUIRES NODE.JS 12.0+!**

![Nodejs](https://img.shields.io/badge/-Node.js%2012.0%2B-brightgreen?style=for-the-badge&logo=node.js&labelColor=1a1a1a)

# Example
```javascript
const ShotWars = require("shotwars");

const options = {
    name: "Anonymous",
    class: ShotWars.vClass.Pistol
};

const client = new ShotWars.Client(options);

client.on("id", () => {
    console.log("Connected to the server");
    client.chat("Hello, world!");
});
```

# Events
`open` - Opened WebSocket connection.\
`close` - Closed WebSocket connection.\
`join` - Joined to the server.\
`id` - Got id.\
`message` - Any message from WebSocket server.\
`leaderboard` - Returns an object with leaders.\
`voteUpdate` - Returns list of votes.\
`medkitUpdate` - Medkit respawned.

# Options
`name (optional)` - Player name (default: `true`).\
`class (optional)` - Player class (default: `ak-47`).\
`skin (optional)` - Player skin (should be set to vclass name) (default: `ak-47`).\
`autospawn (optional)` - Autospawn on connect (default: `true`).\
`server (optional)` - Server (default: `eu1`).\
`ws (optional)` - WebSocket URL (default: `server`).

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