@janderedev/revolt.js
TypeScript icon, indicating that this package has built-in type declarations

6.0.20-patch.9 • Public • Published

Revolt.js fork for AutoMod

This fork contains modifications used in AutoMod. All modifications are disabled by default and need to be enabled by passing options to the client object.

List of features:

  • fixReplyCrash: Normally, if the client reply()s to a message after it has been deleted, it will throw an exception. With this option enabled, the client will instead attempt to resend the message without the reply.
  • messageTimeoutFix: Fixes a weird issue I encountered where Revolt never replied when sending a message, resulting in random Cloudflare timeout errors. If this is enabled, sendMessage() ignores timeout errors and instead uses the WS message event to construct the message object. Might have negative side effects that I'm not aware of yet.
  • messageRateLimiter - Wait and retry when hitting a rate limit while sending a message instead of throwing an error.

revolt.js

revolt.js revolt-api

revolt.js is a direct implementation of the entire Revolt API and provides a way to authenticate and start communicating with Revolt servers.

Example Usage (Javascript / ES6)

import { Client } from "revolt.js";

let client = new Client();

client.on("ready", async () =>
    console.info(`Logged in as ${client.user.username}!`),
);

client.on("message", async (message) => {
    if (message.content === "hello") {
        message.channel.sendMessage("world");
    }
});

client.loginBot("..");

If you are using Node, you must specify --experimental-specifier-resolution=node.

For example, node --experimental-specifier-resolution=node index.js.

Example Usage (CommonJS)

const { Client } = require("revolt.js");

let client = new Client();

client.on("ready", async () =>
    console.info(`Logged in as ${client.user.username}!`),
);

client.on("message", async (message) => {
    if (message.content === "hello") {
        message.channel.sendMessage("world");
    }
});

client.loginBot("..");

Example Usage (Typescript)

import { Client } from "revolt.js";

let client = new Client();

client.on("ready", async () =>
    console.info(`Logged in as ${client.user!.username}!`),
);

client.on("message", async (message) => {
    if (message.content === "hello") {
        message.channel!.sendMessage("world");
    }
});

client.loginBot("..");

MobX

MobX is used behind the scenes so you can subscribe to any change as you normally would, e.g. with mobx-react(-lite) or mobx's utility functions.

import { autorun } from 'mobx';

[..]

client.once('ready', () => {
    autorun(() => {
        console.log(`Current username is ${client.user!.username}!`);
    });
});

Revolt API Types

All revolt-api types are re-exported from this library under API.

import { API } from "revolt.js";

// API.Channel;
// API.[..];

Readme

Keywords

none

Package Sidebar

Install

npm i @janderedev/revolt.js

Weekly Downloads

24

Version

6.0.20-patch.9

License

MIT

Unpacked Size

516 kB

Total Files

75

Last publish

Collaborators

  • janderedev