Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

djs-messagecollector

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

djs-messagecollector

This is a npm package made so you can set up message collectors in discord.js easier and simplier!

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

What is this?

This is a npm package that is made for the sole purpose of simplifying Message Collectors for you! Message Collectors are what you use to collect message in discord.js

installation

npm i djs-messagecollector Or yarn add djs-messagecollector

How to use

const MessageCollector = require('djs-messagecollector');

// then you create a new MessageCollector Class <There are default values.>
const collector = new MessageCollector({ message: Discord.Message }) // read more about the paramaters of this class below. this is using all of the default values.

// start your collector
const collect = collector.start();

collector.on('collect', message => { // The message that was collected.
    console.log(message.content) // logging the message content...
})

collector.on('end', (collected, reason) => { // collected => the collected message, reason => the reason for the collectors end.
    console.log(collected);
})

collector.on('dispose', message => { // The message that was disposed of.
    console.log(message)
})

collector.resetTimer({ time: 60000, idle: 10000}) // resets the collectors timer read more on the djs guide https://discord.js.org/#/docs/main/master/class/MessageCollector?scrollTo=resetTimer

collector.stop(`Because i don't want it to run anymore. <optional>`) // ends the collecter and emits the 'end' event

collector.dispose(Discord.Message) // Disposes of a message and emits the 'dispose' event.

Paramaters

MessageCollector Class

  • constructor
    • Object: Properties Below.
    • message: Discord.Message
    • channel: Discord.TextChannel | Discord.TextChannel
    • max : number, "The max messages to be collected" DEFAULT OF 1
    • time : number, "The set time as were the collector would end." DEFAULT OF 60000
    • filter: Function, "The Message Collector filter." DEFAULT OF (m) => m.author.id === message.author.id;
  • Functions
    • start(): Starts the message collector.
    • stop(reason<optional>): Stops the message collector.
    • dispose(message: Discord.Message): Disposes of a message and emits the dispose event.
    • on(event: "collect" | "end" | "dispose", callback(paramaters)): listenes for a particular event.
    • resetTimer(Options: {time: number, idle: number}): Resets the collectors timer.

FAQs

Package last updated on 06 Mar 2021

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