3.0.12 • Published 2 years ago

@biscuitland/ws v3.0.12

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

@biscuitland/ws

Advice

This version of @biscuitland/ws is a fork of @discordeno/gateway, all credits go to them. However it has been heavily modified for proper use within biscuit.

Most importantly, biscuit's ws is:

A standalone gateway to interface Discord, it is meant to be used with a rest manager to send fetch requests to Discord

Install (for node18)

npm install @biscuitland/ws
yarn add @biscuitland/ws

Example

import { ShardManager } from "@biscuitland/ws";
import { BiscuitREST, Router } from "@biscuitland/rest";
import { GatewayIntentBits } from "@biscuitland/common";

const intents = GatewayIntentBits.Guilds;
const token = "your token goes here";
const rest = new BiscuitREST({ token });
const api = new Router(rest).createProxy();

(async () => {
  const connection = await api.gateway.bot.get();

  // gateway bot code ↓
  const ws = new ShardManager({
    token,
    intents,
    connection,
    async handlePayload(shardId, payload) {
      console.log("Received payload on shard #%s", shardId, payload);
    },
  });

  await ws.spawnShards();
})();

Links

3.0.12

2 years ago

3.0.11

2 years ago

3.0.9

2 years ago

3.0.10

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.4

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.3.0

2 years ago

2.2.3

2 years ago

2.1.2

3 years ago

2.2.0

3 years ago

2.2.2

3 years ago

2.1.1

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.6

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago