5.1.0-alpha.8 • Published 3 years ago

@maroxy/revoltjs v5.1.0-alpha.8

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
3 years ago

This is a modified version of the actual revolt.js module meant purely for use on chat.mxy.gg

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

let client = new Client();

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

client.on('message', async message => {
    if (message.content === 'sus') {
        message.channel!.sendMessage('sus!');
    }
});

// To login as a bot:
client.loginBot('..');

// To login as a user,
// either create a new session:
client.login({ email: '..', password: '..' });

// Or use an existing session:
client.useExistingSession({ token: '..' });

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}!`);
    });
});