oceanic-collectors
v1.0.7
Published
Fully typed collectors for Oceanic.
Downloads
406
Maintainers
Readme
Oceanic Collectors
Fully typed collectors for Oceanic.
Installing
You will need NodeJS 16.16.0+.
npm install oceanic-collectors
Message Collector Example
const { MessageCollector } = require('oceanic-collectors');
const filter = (message) => message.author.id === 'ANY USER ID';
const collector = new MessageCollector(client, channel, { filter, time: 60_000 });
collector.on('collect', (message) => {
console.log(message);
})
collector.on('end', (collectedMessages) => {
console.log(collectedMessages.length);
})
awaitMessages Example
const { awaitMessages } = require('oceanic-collectors');
const filter = (message) => message.author.id === 'ANY USER ID';
const messages = await awaitMessages(client, channel, { filter, max: 2, time: 60_000 });
console.log(messages.length);
License
Refer to the LICENSE file.