Designate a channel as #community-polls or something and place a message in there, the bot will automatically react using the emojis the message has used and have the community use that to make a poll.
//This is the message.create variant of the poll maker. I may make a command variant of this.
//If you do use this, make sure the bot can only see the poll channel and that channel only so it does not fill up requests.
//Made by Lilac🍥Syringa🌸
//Apparently, the regex i'm using does not support emoji (face and hand) tones and specifically black cat emoji. In this case, it thinks they're the normal variant (the default yellow version).
//Example msg:
//Favourite Colour? 🟥🟧🟨🟩
//Then the bot will react with those emojis respectively.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const sleep = async ms => new Promise(r => setTimeout(r, ms));
const seconds = 5; //Seconds to remove the no emoji message thing. :v
let PollMSG = context.params.event.content;
let PollChannels = `` //Put the channel id of the designated pol channel here.
if(context.params.event.channel_id == PollChannels){ //Checks if the message is in the poll channel.
let emojiContent = PollMSG.match(/(<:.+?:\d+>|(?<=<)a:.+?:\d+(?=>))|(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g)
//Regex to match both custom and default emojis
//Checks if there were valid emojis
if(emojiContent == null){ //No emojis detected
const info_message = await lib.discord.channels['@0.2.2'].messages.create({ //makes a message to tell you if there are no emojis.
channel_id: `${context.params.event.channel_id}`,
content: `Use an **emoji** to make a poll.`
});
const BotMessage_id = info_message.id
//Delay in miliseconds repeated by the amount of seconds set.
for (let i = seconds; i > 0; i--) {
await sleep(1000)
}
await lib.discord.channels['@0.2.0'].messages.destroy({
message_id: BotMessage_id,
channel_id: `${context.params.event.channel_id}`,
});
await lib.discord.channels['@0.2.0'].messages.destroy({
message_id: `${context.params.event.id}`,
channel_id: `${context.params.event.channel_id}`,
});
console.log(`No emoji detected`)
}
else { //If there are emojis.
for (let reactCount = 0; reactCount < emojiContent.length; reactCount++) { //loop function
await lib.discord.channels['@0.2.2'].messages.reactions.create({ //Reacts on the message with the emojis.
emoji: `${emojiContent[reactCount]}`,
message_id: `${context.params.event.id}`,
channel_id: `${context.params.event.channel_id}`
});
}
console.log(emojiContent)
}
}