gui

guiworks

A React-style Discord.js library for interactive embeds

Showing:

Popularity

Downloads/wk

0

GitHub Stars

0

Maintenance

Last Commit

2yrs ago

Contributors

1

Package

Dependencies

2

Size (min+gzip)

0.2KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Readme

guiworks

A React-style Discord.js library for interactive embeds

Installation

You can install guiworks using either

npm install --save guiworks

or

yarn add guiworks

Usage

First, you need to initialize a Guiworks instance right after your Discord.js client

import Guiworks from "guiworks";

const client = new Discord.Client();
const guiworks = new Guiworks();

Now you can register new Gui instances by running guiworks.add()

guiworks.add(textChannel, new MyGreatGui());

Guis

A basic Gui only needs to extend Guiworks's Gui class and implement the methods update and render, and either targetReactions or automaticRender

import { Gui } from "guiworks";

class MyGreatGui extends Gui {
    constructor() {
        super();
    }

    update(event) {}

    render() {
        const embed = new Discord.RichEmbed();
        embed.setTitle("This is my great Gui!");
        return embed;
    }

    targetReactions() {
        return ["👍"]
    }

    automaticRender() {
        // Automatic render every 15 seconds;
        return 15000;
    }
}

update gets called every time a reaction gets added or removed. An event has a type, and it can be either reactionAdd or reactionRemove.

For both, there are also reaction and user variables set

Other functions that you can implement are initialize(), finalize() and isParticipating(user).

Every implementation of Gui also provides two functions, triggerRender() to trigger a re-render at will, and terminate(), which will tell the Guiworks instance to terminate the Gui instance.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100