New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

guiworks

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

guiworks

A React-style Discord.js library for interactive embeds

  • 0.1.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 04 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc