npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

manbo-collector

v0.0.3

Published

A Collector for Manbo

Readme

Collector

A Collector for manbo based bots

Features

  • Works with latest manbo package.
  • Supports MessageCollector and awaitMessages.
  • Supports ReactionCollector and awaitReactions.
  • Supports InteractionCollector and awaitInteractions.
  • Configurable message, channel, guild, interaction options.
  • Configurable time, idle, dispose, max options.
  • Active community and fast support.

Install

NPM

npm install manbo-collector

Yarn

yarn add manbo-collector

PNPM

pnpm add manbo-collector

API

Message

MessageCollector

Create a collector to collect messages in the channel

Parameters:

  • client: The client to apply a collector

    • Type: Manbo.Client (see more information in Client)
    • Required: true
  • channel: The channel to collect messages

    • Type: Manbo.TextChannel (see more information in TextChannel)
    • Required: true
  • options: Collector options

    |options|type|description| |------|---|---| |dispose?|boolean|Whether to dispose data when it's deleted| |idle?|number|How long to stop the collector after inactivity in milliseconds| |max?|number|The maximum total amount of data to collect| |time?|number|How long to run the collector for in milliseconds| |filter?|function|The filter applied to this collector|

Methods:

  • stop: Stop this collector

    |param|default|description| |---|---|---| |reason?|user|The reason to stop this collector

    Example:

    collector.stop('custom reason')
    collector.stop() // reason: `user` (default)
  • resetTimer: Reset the time to end this collector

    • ResetTimerOptions

      |param|type|description| |---|---|---| |idle?|number|How long to stop the collector after inactivity in milliseconds| |time?|number|How long to run the collector for in milliseconds|

    Example:

    collector.resetTimer({idle: 15_000, time: 30_000})
    collector.resetTimer({idle: 150_000})
    collector.resetTimer({time: 30_000})
  • empty: Empty the collected data of this collector

    Example:

    collector.empty()

Examples:

import { MessageCollector } from 'manbo-collector'
import { Client, Constants, Message } from 'manbo'

const client = new Client("Bot BOT_TOKEN", {
    intents: Constants.Intents.all
})

client.on('messageCreate', async (message: Message) => {
    // its only to show how collector can be used,
    // you need to configure your own message handler in oreder to use collector precisely

    // filter message, only collect original message author's message
    const filterFunction = (msg: Message) => msg.author.id === message.author.id

    const collector = new MessageCollector(client, message.channel, {
        dispose: true, // delete data when collector ends
        idle: 10_000, // stop collector when there are no messaegs for 10 seconds
        max: 5, // collect max five messages
        time: 30_000, // end collector after 30 seconds
        filter: filterFunction
    })

    collector.on('collect', (collectedMessage) => {
        console.log(`collected message: ${collectedMessage.id}`)
    })

    collector.on('end', (collectedMessages) => {
        console.log(`collected ${collectedMessages.length} messages`)
    })
})
const { MessageCollector } = require('manbo-collector')
const { Client, Constants } = require('manbo')

const client = new Client("Bot BOT_TOKEN", {
    intents: Constants.Intents.all
})

client.on('messageCreate', async (message) => {
    // its only to show how collector can be used,
    // you need to configure your own message handler in oreder to use collector precisely

    // filter message, only collect original message author's message
    const filterFunction = (msg) => msg.author.id === message.author.id

    const collector = new MessageCollector(client, message.channel, {
        dispose: true, // delete data when collector ends
        idle: 10_000, // stop collector when there are no messaegs for 10 seconds
        max: 5, // collect max five messages
        time: 30_000, // end collector after 30 seconds
        filter: filterFunction
    })

    collector.on('collect', (collectedMessage) => {
        console.log(`collected message: ${collectedMessage.id}`)
    })

    collector.on('end', (collectedMessages) => {
        console.log(`collected ${collectedMessages.length} messages`)
    })
})

awaitMessages

A method to collect messages in TextChannel

Parameters:

  • client: The client to apply in a method

    • Type: Manbo.Client (see more information in Client)
    • Required: true
  • channel: The channel to collect messages

    • Type: Manbo.TextChannel (see more information in TextChannel)
    • Required: true
  • options: Collect options

    |options|type|description| |------|---|---| |dispose?|boolean|Whether to dispose data when it's deleted| |idle?|number|How long to stop this collecting method after inactivity in milliseconds.| |max?|number|The maximum total amount of data to collect| |time?|number|How long to run this collecting method for in milliseconds| |filter?|function|The filter applied to this collecting method|

  • Returns:

    Promise<Manbo.Message[]> (see more information in awaitMessages)

Examples:

import { awaitMessages } from 'manbo-collector'
import { Client, Constants, Message } from 'manbo'

const client = new Client("Bot BOT_TOKEN", {
    intents: Constants.Intents.all
})

client.on('messageCreate', async (message: Message) => {
    // its only to show how collector can be used,
    // you need to configure your own message handler in oreder to use collector precisely

    // filter message, only collect original message author's message
    const filterFunction = (msg: Message) => msg.author.id === message.author.id

    const collectedMessages = await awaitMessages(client, message.channel, {
        dispose: true, // delete data when collector ends
        idle: 10_000, // stop collector when there are no messaegs for 10 seconds
        max: 5, // collect max five messages
        time: 30_000, // end collector after 30 seconds
        filter: filterFunction
    })

    console.log(`collected ${collectedMessages.length} messages`)
})
const { awaitMessages } = require('manbo-collector')
const { Client, Constants } = require('manbo')

const client = new Client("Bot BOT_TOKEN", {
    intents: Constants.Intents.all
})

client.on('messageCreate', async (message) => {
    // its only to show how collector can be used,
    // you need to configure your own message handler in oreder to use collector precisely

    // filter message, only collect original message author's message
    const filterFunction = (msg) => msg.author.id === message.author.id

    const collectedMessages = await awaitMessages(client, message.channel, {
        dispose: true, // delete data when collector ends
        idle: 10_000, // stop collector when there are no messaegs for 10 seconds
        max: 5, // collect max five messages
        time: 30_000, // end collector after 30 seconds
        filter: filterFunction
    })

    console.log(`collected ${collectedMessages.length} messages`)
})

Reaction

ReactionCollector

Create a collector to collect message reactions in a message

same as MessageCollector but with reactions

awaitReactions

A method to collect message reactions in a message

same as awaitMessages but with reactions

too lazy to add same of this again and again and again and again...

Interaction

InteractionCollector

Create a collector to collect interactions in the channel

Parameters:

  • client: The client to apply a collector

    • Type: Manbo.Client (see more information in Client)
    • Required: true
  • options: Collector options

    |options|type|description| |------|---|---| |dispose?|boolean|Whether to dispose data when it's deleted.| |idle?|number|How long to stop the collector after inactivity in milliseconds.| |max?|number|The maximum total amount of data to collect| |time?|number|How long to run the collector for in milliseconds| |filter?|function|The filter applied to this collector| |channel?|TextChannel|The channel to listen to interactions from| |guild?|Guild|The guild to listen to interactions from| |interaction?|AutoCompleteInteraction or CommandInteraction or ComponentInteraction|The interaction response to listen to message component interactions from| |message?|Message|The message to listen to interactions from| |componentType?|ComponentType|The type of components to listen for| |interactionType?|InteractionType|The type of interactions to listen for|

Methods:

  • stop: Stop this collector

    |param|default|description| |---|---|---| |reason?|user|The reason to stop this collector

    Example:

    collector.stop('custom reason')
    collector.stop() // reason: `user` (default)
  • resetTimer: Reset the time to end this collector

    • ResetTimerOptions

      |param|type|description| |---|---|---| |idle?|number|How long to stop the collector after inactivity in milliseconds| |time?|number|How long to run the collector for in milliseconds|

    Example:

    collector.resetTimer({idle: 15_000, time: 30_000})
    collector.resetTimer({idle: 150_000})
    collector.resetTimer({time: 30_000})
  • empty: Empty the collected data of this collector

    Example:

    collector.empty()

Examples:

import { InteractionCollector } from 'manbo-collector'
import { Client, Constants, Message } from 'manbo'

const client = new Client("Bot BOT_TOKEN", {
    intents: Constants.Intents.all
})

client.on('messageCreate', async (message: Message) => {
    // its only to show how collector can be used,
    // you need to configure your own message handler in oreder to use collector precisely

    const msg = await message.channel.createMessage({
        content: 'An InteractionCollector',
        components: [
            {
                type: Constants.ComponentTypes.ACTION_ROW,
                components: [
                    {
                        type: Constants.ComponentTypes.BUTTON,
                        custom_id: `a custom ID of button component`,
                        label: `A label to be displayed in button`,
                        style: Constants.ButtonStyles.SECONDARY,
                        emoji: {
                            id: null,
                            name: '✅'
                        }
                    }
                ]
            }
        ]
    })
    
    
    const collector = new InteractionCollector(client, msg.channel, {
        dispose: true, // delete data when collector ends
        idle: 10_000, // stop collector when there are no messaegs for 10 seconds
        max: 5, // collect max five messages
        time: 30_000 // end collector after 30 seconds
        // I'd prefer to handle all interaction becuase it would cause interaction fail
        // filter: None
    })

    collector.on('collect', async (collectedInteraction) => {
        // defer interaction
        await collectedInteraction.defer(64)
        
        // handle filter
        if (collectedInteraction.member!.id !== message.author.id)
            await collectedInteraction.createFollowup({
                content: `Only message author can use this button!`,
                flags: 64
            })
        else {
            // since i didnt used filter, you can just add internal Collection cleanup or just use filter :>
            await collectedInteraction.createFollowup({
                content: `collected interaction: ${collectedInteraction.id}`,
                flags: 64
            })
            /*
            You can also do things like:
            
            await msg.edit({
                content: `edit original message`
            }) 
            
            or just acknowldge interaction without `.defer()` using `editParent`:
            
            await collectedInteraction.editParent({
                content: `also edits original message but also acknowledgs interaction`
            })
            */
        }
    })

    collector.on('end', (collectedInteractions) => {
        console.log(`collected ${collectedInteractions.length} interactions`)
    })
})
const { MessageCollector } = require('manbo-collector')
const { Client, Constants } = require('manbo')

const client = new Client("Bot BOT_TOKEN", {
    intents: Constants.Intents.all
})

client.on('messageCreate', async (message) => {
    // its only to show how collector can be used,
    // you need to configure your own message handler in oreder to use collector precisely

    const msg = await message.channel.createMessage({
        content: 'An InteractionCollector',
        components: [
            {
                type: Constants.ComponentTypes.ACTION_ROW,
                components: [
                    {
                        type: Constants.ComponentTypes.BUTTON,
                        custom_id: `a custom ID of button component`,
                        label: `A label to be displayed in button`,
                        style: Constants.ButtonStyles.SECONDARY,
                        emoji: {
                            id: null,
                            name: '✅'
                        }
                    }
                ]
            }
        ]
    })


    const collector = new InteractionCollector(client, msg.channel, {
        dispose: true, // delete data when collector ends
        idle: 10_000, // stop collector when there are no messaegs for 10 seconds
        max: 5, // collect max five messages
        time: 30_000 // end collector after 30 seconds
        // I'd prefer to handle all interaction becuase it would cause interaction fail
        // filter: None
    })

    collector.on('collect', async (collectedInteraction) => {
        // defer interaction
        await collectedInteraction.defer(64)

        // handle filter
        if (collectedInteraction.member.id !== message.author.id)
        await collectedInteraction.createFollowup({
            content: `Only message author can use this button!`,
            flags: 64
        })
    else {
            // since i didnt used filter, you can just add internal Collection cleanup or just use filter :>
            await collectedInteraction.createFollowup({
                content: `collected interaction: ${collectedInteraction.id}`,
                flags: 64
            })
            /*
            You can also do things like:
            
            await msg.edit({
                content: `edit original message`
            }) 
            
            or just acknowldge interaction without `.defer()` using `editParent`:
            
            await collectedInteraction.editParent({
                content: `also edits original message but also acknowledgs interaction`
            })
            */
        }
    })

    collector.on('end', (collectedInteractions) => {
        console.log(`collected ${collectedInteractions.length} interactions`)
    })
})

awaitComponentInteractions

A method to collect component interactions

Parameters:

  • client: The client to apply in a method

    • Type: Manbo.Client (see more information in Client)
    • Required: true
  • options: Collect options

    |options|type|description| |------|---|---| |dispose?|boolean|Whether to dispose data when it's deleted.| |idle?|number|How long to stop the collecting method after inactivity in milliseconds.| |time?|number|How long to run the collecting method for in milliseconds| |filter?|function|The filter applied to this collecting method| |componentType?|ComponentType|The type of components to listen for|

  • Returns:

    Promise<MappedComponentTypes[]> (see more information in MappedComponentTypes)

Examples:

import { awaitMessages } from 'manbo-collector'
import { Client, Constants, Message } from 'manbo'

const client = new Client("Bot BOT_TOKEN", {
    intents: Constants.Intents.all
})

client.on('messageCreate', async (message: Message) => {
    // its only to show how collector can be used,
    // you need to configure your own message handler in oreder to use collector precisely

    // filter message, only collect original message author's message
    const filterFunction = (msg: Message) => msg.author.id === message.author.id

    const collectedMessages = await awaitMessages(client, message.channel, {
        dispose: true, // delete data when collector ends
        idle: 10_000, // stop collector when there are no messaegs for 10 seconds
        max: 5, // collect max five messages
        time: 30_000, // end collector after 30 seconds
        filter: filterFunction
    })

    console.log(`collected ${collectedMessages.length} messages`)
})
const { awaitMessages } = require('manbo-collector')
const { Client, Constants } = require('manbo')

const client = new Client("Bot BOT_TOKEN", {
    intents: Constants.Intents.all
})

client.on('messageCreate', async (message) => {
    // its only to show how collector can be used,
    // you need to configure your own message handler in oreder to use collector precisely

    // filter message, only collect original message author's message
    const filterFunction = (msg) => msg.author.id === message.author.id

    const collectedMessages = await awaitMessages(client, message.channel, {
        dispose: true, // delete data when collector ends
        idle: 10_000, // stop collector when there are no messaegs for 10 seconds
        max: 5, // collect max five messages
        time: 30_000, // end collector after 30 seconds
        filter: filterFunction
    })

    console.log(`collected ${collectedMessages.length} messages`)
})

Events

|name|callback params|description| |---|---|---| |collect|collected (The element collected)|Emitted whenever something is collected| |dispose|disposed (The element disposed)|Emitted whenever something is disposed| |ignored|ignored (The element ignored)|Emitted whenever something is ignored| |end|collected (The data collected by the collector) reason (The reason the collector has ended)|Emitted whenever the collector stops collecting|

Example:

collector.on('collect', (collected) => {
    console.log(`collected: ${collected}`)
})
collector.on('dispose', (disposed) => {
    console.log(`disposed: ${disposed}`)
})
collector.on('ignored', (ignored) => {
    console.log(`ignored: ${ignored}`)
})
collector.on('end', (collected, reason) => {
    console.log(`collector ended with reason: ${reason}`)
    console.log(`collected: ${collected}`)
})

Contribute

PRs are always welcomed! Feel free to submit PRs!