Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicolasmf/discord.js-poll
A poll command package for JS discord bots
https://github.com/nicolasmf/discord.js-poll
discord discord-bot discord-js
Last synced: 3 months ago
JSON representation
A poll command package for JS discord bots
- Host: GitHub
- URL: https://github.com/nicolasmf/discord.js-poll
- Owner: nicolasmf
- License: mit
- Created: 2021-04-19T10:09:22.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-19T16:52:31.000Z (over 2 years ago)
- Last Synced: 2024-11-14T11:45:03.675Z (3 months ago)
- Topics: discord, discord-bot, discord-js
- Language: TypeScript
- Homepage:
- Size: 13 MB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# discord.js-poll
![npm](https://img.shields.io/npm/v/discord.js-poll)
![NPM](https://img.shields.io/npm/l/discord.js-poll)
![npm](https://img.shields.io/npm/dt/discord.js-poll)discord.js-poll is a Node.js module that allows you to create polls with your discord bot. You can customize the separator (between the title and the options) and the color of the embed.
## Installation
```
npm i discord.js-poll
```## Parameters type
```JavaScript
poll(message: Discord.Message, args: string[], separator: string, embedColor: Discord.ColorResolvable)
```
### Documentation[Discord.Message](https://discord.js.org/#/docs/main/stable/class/Message)
[Discord.ColorResolvable](https://discord.js.org/#/docs/main/stable/typedef/ColorResolvable)
## Usage example
### Code
```JavaScript
const Discord = require('discord.js');
const { poll } = require('discord.js-poll');module.exports = {
name: 'poll',
description: 'Create a poll',
usage: 'Title + Option 1 + Option 2 + Option 3 + etc',
execute(client, message, args) {
poll(message, args, '+', '#00D1CD');
},
};
```### On discord
```
!poll Is this a poll ?
```This will return an embed message with '**Is this a poll ?**' as title and with 👍 and 👎 reactions.
![Simple Poll Image](https://cdn.discordapp.com/attachments/417731712135725066/834428865342472212/unknown.png)
```
!poll What is your favorite food ? + Pasta + Burgers + Pizza
```This will return an embed message with '**What is your favorite food ?**' as title and '*Pasta*', '*Burger*' and '*Pizza*' as fields, with corresponding reactions (🇦 => 🇨).
(If **'+'** is chosed as separator)
![Poll Image](https://cdn.discordapp.com/attachments/417731712135725066/834428463616229456/unknown.png)
### ⚠️ You cannot add more than 26 options to the poll.