Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scar17off/shotwars-js
The ShotWars.io API for bots
https://github.com/scar17off/shotwars-js
Last synced: 22 days ago
JSON representation
The ShotWars.io API for bots
- Host: GitHub
- URL: https://github.com/scar17off/shotwars-js
- Owner: scar17off
- License: gpl-3.0
- Created: 2023-10-17T20:44:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-21T07:21:46.000Z (7 months ago)
- Last Synced: 2024-11-13T20:12:42.780Z (about 2 months ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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`).