For the brunch at the office, employees are required to type "Yes" or "No" on a Discord channel. However, this often leads to low engagement as some employees forget or skip responding.
The Discord Poll DB bot automates the process by regularly reminding users of the brunch poll. The bot posts a message in a designated Discord channel every weekday at 7 AM (Nepal Time), with options to vote "Yes" or "No" for brunch. It also collects and displays the results after a predefined period (e.g., 2 hours).
- Automated Polling: Sends daily poll reminders for brunch at the office.
- Simple Voting: Users can vote with a button click ("Yes" or "No").
- Poll Results: After a set time (2 hours), the bot displays the list of users who voted "Yes" or "No".
- Recurring Polling: Polling happens from Monday to Friday at 7 AM (Nepal Time).
- Holiday Integration: Automatically skips polling on holidays, sending a friendly holiday message instead (e.g., "🎉 Today is [Holiday Name]. Enjoy your holiday!").
- Clone the repository:
git clone https://github.com/dnesbala/discord-poll-bot
cd discord-poll-db
- Install dependencies:
npm install
- Set up your
.env
file with the following (refer to the provided.example.env
file):
DISCORD_TOKEN=your_discord_bot_token
DISCORD_CHANNEL_ID=your_discord_channel_id_where_to_ask_poll
- Start the bot:
npm start
Note: Update discord channel id on code if required.
The bot uses the node-cron
library to schedule the poll reminder to run at 7 AM every Monday to Friday. You can modify the schedule in the code if needed.
Example cron expression for 7 AM Monday to Friday:
cron.schedule(
"0 7 * * 1-5",
() => {
// Poll logic here
},
{ timezone: "Asia/Kathmandu" }
);
You can change this to another time by adjusting the cron expression.
-
The bot sends a message in the designated Discord channel every weekday at 7 AM (Nepal Time) with the following poll options:
- Yes: Users want brunch.
- No: Users do not want brunch.
-
Users vote by clicking on the Yes or No buttons.
-
After 2 hours, the bot automatically collects all responses and posts the results in the same channel.
To contribute to this project, follow these steps:
-
Fork the repository.
-
Create a feature branch:
git checkout -b feature-branch
-
Commit your changes:
git commit -am 'Add new feature'
-
Push to the branch:
git push origin feature-branch
-
Open a Pull Request.