3.3.0 • Published 4 months ago

rce.js v3.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

rce.js

A library for developers to easily create their own Rust Console Edition integrations such as discord bots using GPORTAL's API & WebSocket!

Documentation

For a more in-depth documentation, refer to GitBook! You can also join our support discord server

Installation

npm i b1nzeex/rce.js

Example Usage - TypeScript

import { RCEManager, LogLevel, RCEEvent, RCEIntent } from "rce.js";

const rce = new RCEManager();
await rce.init({ username: "", password: "" }, { level: LogLevel.Info });

await rce.servers.addMany([
  {
    identifier: "server1", // A Unique Name For your Server To Be Recognised By
    region: "US", // It's Either EU or US
    serverId: 1387554, // Find This In The URL On Your Server Page
    intents: [RCEIntent.ConsoleMessages], // Specify Which WebSocket Subscriptions To Use
    playerRefreshing: true, // Enable Playerlist Caching
    radioRefreshing: true, // Enable RF Events
    extendedEventRefreshing: true, // Enable Bradley / Heli Events
  },
  {
    identifier: "server2",
    region: "EU",
    serverId: 1487367,
    intents: [RCEIntent.All],
  },
]);

rce.events.on(RCEEvent.PlayerKill, (data) => {
  console.log(
    `[${data.server.identifier}] ${data.killer.name} killed ${data.victim.name}`
  );

  // Send an in-game command to the Rust server by the unique identifier (kill-feed!)
  await rce.servers.command(
    data.server.identifier,
    `say <color=red>${data.killer.name}</color> killed <color=red>${data.victim.name}</color>`
  );
});

// Optional Methods
await rce.servers.add(SERVER_INFO); // Add A Single Server
await rce.servers.addMany([SERVER_INFO]); // Add Multiple Servers
rce.servers.remove("identifier"); // Remove A Server
rce.servers.removeAll(); // Remove All Servers
rce.servers.get("identifier"); // Get Server
await rce.servers.info("identifier"); // Get "serverinfo" Command Details
await rce.servers.command("identifier", "say Hello World"); // Send Command
rce.destroy(); // Gracefully Close RCE.JS
3.3.0

4 months ago

3.1.1

6 months ago

3.1.0

9 months ago

3.0.2

9 months ago

3.0.1

9 months ago

2.3.0

10 months ago

2.1.2

11 months ago

2.0.3

11 months ago

2.2.0

10 months ago

2.1.1

11 months ago

2.0.2

11 months ago

2.5.0

10 months ago

2.4.1

10 months ago

2.1.4

10 months ago

2.0.5

11 months ago

2.4.0

10 months ago

2.1.3

11 months ago

2.0.4

11 months ago

2.6.1

9 months ago

2.5.2

10 months ago

2.6.0

9 months ago

2.5.1

10 months ago

2.4.2

10 months ago

2.6.2

9 months ago

2.1.0

11 months ago

2.0.1

11 months ago

2.0.0

11 months ago

3.0.0

9 months ago

1.3.1

11 months ago

1.3.0

11 months ago

1.2.5

11 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

11 months ago

1.2.0

11 months ago

1.1.2

12 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago