# discord-collector

> Library to easily create message collector and reactions on discord, with customization ways

Latest version **1.11.18** (published 2022-06-06) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install discord-collector
pnpm add discord-collector
yarn add discord-collector
bun add discord-collector
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.11.18 |
| Published | 2022-06-06 |
| First published | 2021-08-01 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 154.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | razegame |
| Keywords | discord, discord.js, discordjs, message collector, message-collector, messages-collector, messages collector, reaction role, reaction roles, color roles, captcha roles, reaction collector, reaction-collector, reaction menu, embed menu, discord paginator, reaction role toggle, reaction roles |

## Links

- npm: https://www.npmjs.com/package/discord-collector
- Repository: https://github.com/RaZeSloth/Discord-Collector
- npm.io page: https://npm.io/package/discord-collector

## Dependencies (3)

- [mquery](https://npm.io/package/mquery.md) ^4.0.2
- [mongoose](https://npm.io/package/mongoose.md) ^6.3.3
- [async-lock](https://npm.io/package/async-lock.md) ^1.3.1

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 1.11.18 (latest) — 2022-06-06
- 1.11.17 — 2022-05-14
- 1.11.16 — 2022-05-14
- 1.11.15 — 2022-01-13
- 1.11.14 — 2022-01-12
- 1.11.13 — 2022-01-08
- 1.11.12 — 2021-12-29
- 1.11.11 — 2021-12-24
- 1.11.10 — 2021-11-01
- 1.11.9 — 2021-10-29
- 1.11.8 — 2021-10-05
- 1.11.7 — 2021-09-15
- 1.11.6 — 2021-08-24
- 1.11.5 — 2021-08-23
- 1.10.5 — 2021-08-22
- … 9 more at https://npm.io/package/discord-collector/versions

## README

# PLEASE READ

## THE FOLLOWING CODE IS BY [THIS](https://github.com/IDjinn) GUY, AND ALL CREDIT GOES TO HIM, I HAVE JUST TWEAKED SOME STUFF.




![downloads-npm-total](https://img.shields.io/npm/dt/discord.js-collector) ![downloads-npm-week](https://img.shields.io/npm/dw/discord.js-collector?color=%234c00ff)  ![dependencies-deprecated-status](https://img.shields.io/david/IDjinn/Discord.js-Collector) ![npm-version](https://img.shields.io/npm/v/discord.js-collector)
# Discord-collector

Library to easily create message collector, reactions collector and reactions role on discord.js v13, with customization ways.


Thank you for using discord-collector! ❤

---

## Summary
◘ Reactions Collectors:\
| [Reaction Role](#reaction-role)\
| [Menu](#reaction-menu)\
| [Question](#simple-reaction-collector)\
| [Yes/No Question](#simple-boolean-reaction-collector)\
| [Embeds Paginator](#embeds-pagination)\
◘ Messages Collectors:\
| [Question](#simple-messages-collector)\
| [Async Question](#async-message-collector)\
◘ Examples\
| [Reaction Role Manager](./examples/reaction-role-manager/basic.js)\
| [Reaction Menu](./examples/reaction-collector/menu.js)\
◘ Others\
| [Changelog](CHANGELOG.md)\
| [Breaking Changes](./BREAKING_CHANGES.md)

## Discord Server

Sorry, but support server was closed for no longer support of this lib

## Documentation

See all documentation of last version [here](https://idjinn.github.io/Discord.js-Collector/)

---

## Reaction role

You can create reactions roles, with amazing functions:\
| • If you bot turns off, when it turns on all users reacted in messages will win the role.\
| • If you bot turns off, if any user remove reaction, when the bot turns on will remove the role from him.\
| • You can store the roles in a JSON file and migrate the reaction role data.\
| • You can limit max roles given by bot, like 10 roles.\
| • Toggled roles: Limit one of these roles to use (Util for colors reaction roles, only get one of roles)\
| • Requirements: Limit roles to only boosters or discord developers win roles!\
| • Just Win: you can configure a role to just give to member if him react on it!\
| • Just Lose: you can configure a role to just take from member if him react on it!\
| • Reversed: When react on it, member will lose the role. When take off reaction of it, member will win the role.


![Reaction Role Gif](./assets/reactionRoles.gif)

You can find this code example [here](./examples/reaction-role-manager/basic.js)

---

## Reaction menu

To create a reaction menu with multiple pages.

![Menu Gif](./assets/reactMenu.gif)

You can find this code example [here](./examples/reaction-collector/menu.js)


## Simple reaction collector

To use in multiple actions, react and then trigger one function to do things.

![Question Gif](./assets/reactQuestion.gif)

## Simple boolean reaction collector

To use in `if` statements, the asynchronous reaction collector returning Promise <boolean> is more practical

![Question Gif](./assets/reactYesNoQuestion.gif)

## Embeds pagination
Example [here](./examples/reaction-collector/paginator.js)

Easier paginator embeds, with back/skip reaction to change current page.

![Question Gif](./assets/reactPaginator.gif)

You can find this code example [here](./examples/reaction-collector/paginator.js)

## Simple messages collector

Await for messages from user, and when it's send will fire a trigger to do things. See exemple [here]

You can find this code example [here](./examples/message-collector/question.js)

![Question Gif](./assets/messageQuestion.gif)

## Async message collector

Await for message from user, and when user send, will return user message as Promise<Message>.

![Question Gif](./assets/messageAsyncQuestion.gif)

```js
const { MessageCollector } = require("discord.js-collector");

const botMessage = await message.channel.send("Awaiting a message");
const userMessage = await MessageCollector.asyncQuestion({
  botMessage,
  user: message.author.id,
});
if (userMessage.content === "ping") {
  await message.channel.send("pong!");
}
```

---
_Source: https://npm.io/package/discord-collector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
