Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/catplvsplus/oceanic-collector
https://github.com/catplvsplus/oceanic-collector
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/catplvsplus/oceanic-collector
- Owner: catplvsplus
- License: gpl-3.0
- Created: 2023-03-17T13:45:45.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-23T07:38:19.000Z (over 1 year ago)
- Last Synced: 2024-10-13T03:24:20.230Z (3 months ago)
- Language: TypeScript
- Size: 38.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Oceanic Collector
A collection of oceanic collectors- [Collector Usage](#collector-usage)
- [Awaiter Usage](#awaiter-usage)> See also [eris-collectors](https://www.npmjs.com/package/eris-collectors)
```
npm i oceanic-collector
yarn add oceanic-collector
pnpm add oceanic-collector
```## Collector Usage
```js
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 stoppedcollector.stop(); // Stop collecting messages
``````js
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 stoppedcollector.stop(); // Stop collecting reactions
``````js
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 stoppedcollector.stop(); // Stop collecting interactions
```## Awaiter Usage
```js
const { awaitMessage } = require('oceanic-collector');// Single message
const message = await awaitMessage({ client, channel });// Multiple messages
const messages = await awaitMessage({ client, channel, max: 0 });
``````js
const { awaitInteraction } = require('oceanic-collector');// Single interaction
const interaction = await awaitInteraction({ client, channel });// Multiple interactions
const interactions = await awaitInteraction({ client, channel, max: 0 });
``````js
const { awaitReaction } = require('oceanic-collector');// Single reaction
const reaction = await awaitReaction({ client, channel });// Multiple reactions
const reactions = await awaitReaction({ client, channel, max: 0 });
```