1.1.1 • Published 2 years ago

eris-collect v1.1.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

Eris-Collect

A message, reaction, interaction collector for Eris. (supports v17.x)

This package is a modified version of Oceanic-Collectors to fit with eris.

If you face any problems, join our discord server (english, korean) for help.

Installing

You need NodeJS 16.16.0+.

npm install eris-collect

Message Collector Example

const { MessageCollector } = require('eris-collect')

const filter = (message) => message.author.id === 'UserID'
const collector = new MessageCollector(client, channel, { filter, time: 60_000 }) // time in ms

collector.on('collect', (message) => {
    console.log(message)
})

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

awaitMessages Example

const { awaitMessages } = require('eris-collect')

const filter = (message) => message.author.id === 'ANY USER ID'
const messages = await awaitMessages(client, channel, { filter, max: 2, time: 60_000 }) // time in ms

console.log(messages.length)

Interaction Collector Example

const { InteractionCollector } = require('eris-collect')

// Return if Interaction was created in DM
// if (!interaction.guildID) return

const filter = (interaction) => interaction.member.id === 'UserID'
const collector = new InteractionCollector(client, channel, { filter, time: 60_000 }) // time in ms

collector.on('collect', (interaction) => {
    console.log(interaction)
})

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

awaitComponentInteractions Example

const { awaitComponentInteractions } = require('eris-collect')

// Return if Interaction was created in DM
// if (!interaction.guildID) return

const filter = (interaction) => interaction.member.id === 'UserID'
const collectedInteractions = await awaitComponentInteractions(client, channel, { filter, max: 5, time: 30_000 }) // time in ms

console.log(collectedInteractions.length)