Skip to content

shockbs/pollcord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pollcord

https://nodei.co/npm/pollcord.png?downloads=true&downloadRank=true&stars=true
Node version contributions welcome HitCount Vulnerabilities License: CC BY-NC 4.0 GitHub Workflow Status Repo Size PRs Welcome FOSSA Status

send polls with discord.js

Support Server: https://discord.gg/zeBet3HrU4 (Free GPT4 API comming soon)

Why PollCord?

  • performant
  • beginnnner friendly image

Getting Started

install pollcord

npm i pollcord

Import pollcord

import PollCord from "pollcord";
const pollcord = PollCord.ShockBS

or

const PollCord = require("pollcord");
const pollcord = PollCord.ShockBS

Usage

pollcord(client, channelId, pollCordOptions, messageOptions)

client

  • interaction
pollcord(interaction.client, interaction.channelId, pollCordOptions, ,messageOptions)
  • message
pollcord(message.client, message.channelId, pollCordOptions, messageOptions)

Docs

import { Client } from "discord.js";
const client = new Client(...)
pollcord(
client,
// discord.js bot client
channelId: String,
// id of the channel to send at
{
  question: String,
  //the question of the poll
  answers: { text: string; emoji: string; }[],
  // an array of answers, text is required
  duration: number | string,
  // how long the poll should lasts, can be a number in hour or string(ex: 1 hour, 90mins, 1 week, etc)
  multiSelect: Boolean,
  //optional, whether to allow multi selection or not, default: true
},
{
  content: String,
  // the content of the poll message
  embeds: [],
  // an array containing EmbedBuilder(s) or embeds json
  components: [],
  // an aray containing the ActionRowBuilder(s) or rows jsons
  files: [],
  // files to attach together in the poll, message. can be AttachmentBuilder(s) or attachment json
  allowedMentions: {...},
  // allowedMentions for the poll message
}
)

pollCordOptions:

const pollCordOptions = {
  question: "How smart is ShockBS?", // question string
  answers: PollCordAnswers, //an array containing poll answers
  duration: "3 days", // you can also pass hours number
  multiSelect: true // whether to allow multi selection or not (default: true)
}

PollCordAnswers:

const PollCordAnswers = {

// without emojis (or you can pass emoji: null)

{
  text: "200 IQ"
},

// passing emoji string

{
  text: "210 IQ",
  emoji: "<a:name:123456789>"
},

// discord default emojis

{
  text: "220 IQ",
  emoji: ":nerd:"
},

// default emojis

{
  text: "230 IQ",
  text: "230 IQ",
  emoji: "πŸ€“"
},

// passing emoji id

{
  text: "240 IQ",
  emoji: "123456789"
}
}

you can only have up to 10 answers per poll

messageOptions (array)

you can also add content, embeds, components, files etc

import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"
const messageOptions = {
content: "@everyone plz vote this poll",
embeds: [
new EmbedBuilder().setColor("Blurple").setDescription("cool poll")
...
],
components: [
new ActionRowBuilder().addComponents(new ButtonBuilder({style: ButtonStyle.Link, label: "Support", url: "https://discord.gg/zeBet3HrU4/"}))
...
]
}
pollcord(base, channelId, pollCordOptions, messageOptions)

Examples:

  • poll only:
pollcord(interaction.client, interaction.channelId, { 
  question: "Why PollCord?", 
  answers: [
    {text:"Performant", emoji:"😏"},
    {text:"easy to use", emoji:"😍"},
    {text: "Beginner Friendly", emoji:"πŸ˜€"}
  ], 
  duration: "7 days" 
});
  • additional:
pollcord(interaction.client, interaction.channelId, { 
  question: "Why PollCord?", 
  answers: [
    {text: "Performant", emoji: "😏"},
    {text: "easy to use", emoji: "😍"},
    {text: "Beginner Friendly", emoji: "πŸ˜€"}
  ], 
  duration: "7 days", 
  multiSelect: true 
}, { 
  content: "@everyone plz vote this poll thx", 
  embeds: [new EmbedBuilder().setColor("Blurple").setDescription("PollCord")], 
  components: [new ActionRowBuilder().addComponents(new ButtonBuilder({style: ButtonStyle.Link, label: "Support", url: "https://discord.gg/zeBet3HrU4/"}))]});

Star History

Star History Chart ### Backlinks [shockbs](https://shockbs.is-a.dev) Support: https://discord.gg/zeBet3HrU4

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published