GithubHelp home page GithubHelp logo

oceanic-collector's Introduction

Oceanic Collector

A collection of oceanic collectors

See also eris-collectors

npm i oceanic-collector
yarn add oceanic-collector
pnpm add oceanic-collector

Collector Usage

const { MessageCollector } = require('oceanic-collector');

const collector = new MessageCollector({
    client: bot,                            // [Required] Your bot client
    channel: channel,                       // [Required] Any text channel
    time: 1000 * 60,                        // [Optional] Collector timeout in milliseconds
    max: 10,                                // [Optional] Max collected messages
    filter: message => !message.author.bot, // [Optional] Custom collector filter
});

collector.on('collect', message => {}); // Emitted when the collector collects a message
collector.on('end', reason => {});      // Emitted when the collector stopped

collector.stop();                       // Stop collecting messages
const { ReactionCollector } = require('oceanic-collector');

const collector = new ReactionCollector({
    client: bot,                            // [Required] Your bot client
    message: message,                       // [Required] A message to collect reactions from
    time: 1000 * 60,                        // [Optional] Collector timeout in milliseconds
    max: 10,                                // [Optional] Max collected reactions
    maxEmojis: 10,                          // [Optional] Max collected emoji
    maxReactors: 10,                        // [Optional] Max reactors
    filter: reaction => true,               // [Optional] custom collector filter
});

collector.on('collect', reaction => {}); // Emitted when the collector collects a reaction
collector.on('end', reason => {});       // Emitted when the collector stopped

collector.stop();                        // Stop collecting reactions
const { InteractionCollector } = require('oceanic-collector');
const { InteractionTypes } = require('oceanic.js');

const collector = new InteractionCollector({
    client: bot,                                         // [Required] Your bot client
    message: message,                                    // [Optional] A message to collect interactions from
    channel: channel,                                    // [Optional] Collects interactions in a channel
    guild: guild,                                        // [Optional] Collects interactions from a guild
    interactionType: InteractionTypes.MESSAGE_COMPONENT, // [Optional] Sets the interaction type to collect
    maxUsers: maxUsers,                                  // [Optional] Set max users to interact to this collector
    time: 1000 * 60,                                     // [Optional] Collector timeout in milliseconds
    max: 10,                                             // [Optional] Max collected reactions
    filter: interaction => true,                         // [Optional] custom collector filter
});

collector.on('collect', interaction => {}); // Emitted when the collector collects an interaction
collector.on('end', reason => {});          // Emitted when the collector stopped

collector.stop();                           // Stop collecting interactions

Awaiter Usage

const { awaitMessage } = require('oceanic-collector');

// Single message
const message = await awaitMessage({ client, channel });

// Multiple messages
const messages = await awaitMessage({ client, channel, max: 0 });
const { awaitInteraction } = require('oceanic-collector');

// Single interaction
const interaction = await awaitInteraction({ client, channel });

// Multiple interactions
const interactions = await awaitInteraction({ client, channel, max: 0 });
const { awaitReaction } = require('oceanic-collector');

// Single reaction
const reaction = await awaitReaction({ client, channel });

// Multiple reactions
const reactions = await awaitReaction({ client, channel, max: 0 });

oceanic-collector's People

Contributors

notghex avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.