Rajitha Gunathilake
Rajitha Gunathilake's Dev Blog

Follow

Rajitha Gunathilake's Dev Blog

Follow
Discord Poll Bot on Steroids

Discord Poll Bot on Steroids

Create discord polls with a dashboard and view comprehensive data about the polls in real-time and graphical visualization.

Rajitha Gunathilake's photo
Rajitha Gunathilake
ยทFeb 26, 2022ยท

4 min read

Table of contents

  • Inspiration โœจ
  • Features ๐Ÿค–
  • Tech Stack โš™๏ธ
  • In action ๐ŸŽฌ
  • Developing experience ๐Ÿ’ป
  • Challenges ๐Ÿ’ช
  • Further implementations โ˜„๏ธ
  • Info โ„น๏ธ

Hi everyone,

I have used Discord for quite some time now and came across some instances where we need to create polls. Most polls rely on the message reactions and then after that getting the results.

But what if I told you there is a better way to create a poll to get real-time experience with a feature-rich dashboard.

Introducing Disco-poll a Disord Bot to create polls and get realtime results.

This could potentially increase the productivity of the discord server moderators because it is easier to add and get results and to give a unified experience.

Inspiration โœจ

Some time ago my friend started moderating a discord server for their university groups and I was also a bit involved to give a hand in testing the implemented features. And in that process, i looked into Discordjs library and find out that we can create select menus in the discord chat and then get the response using the discord bot. That clicked and i saw a potential project to create a poll bot with better features. Since the native way of doing a poll is by reacting to a message and then counting them as of now.

Features ๐Ÿค–

  1. Get a detailed version of votes with user vise vote breakdown
  2. Graphical visualization with pie diagram.
  3. Restrict the poll to be a single selection or multi selection.
  4. End and start the poll anytime you want.
  5. Realtime vote data

Tech Stack โš™๏ธ

  1. Supabase for auth and database
  2. Reactjs for client side
  3. Chakra-UI as UI library
  4. Netlify for deploy react app
  5. discordjs library for managing the discord bot
  6. Fastify http server
  7. Heroku for deploy bot server

In action ๐ŸŽฌ

Visit Disco-poll

  • Add the bot to your discord server

invite.png

  • Add Server using the dashboard

addguildmodal.png

  • Create a poll

addpoll.png

  • Watch the members vote your poll

demo

Developing experience ๐Ÿ’ป

I used Reactjs before this project so I had some experience in that area, and i have also used Netlify for my previous projects. It has a really fluid user experience, it has an auto deployment function, so git push and everything is deployed to production . It is also crazy fast because of their awesome CDNs๐Ÿš€.

A bit tricky part was to listen to the discord js message interaction event and then update the users' poll results in the react app. I used Supabase realtime subscriptions to achieve that. so after a new record is updated or inserted it is notified via realtime events , and i update the dashboard data.

Challenges ๐Ÿ’ช

  • This was my first project with Supabase, so I got a bit of a learning curve there, but Supabase was well documented and was really easy to start with, and was a pleasant experience. I did struggle a little bit on realtime data, and stared at my screen for a while then to realize that i didn't turn replication on , so bit nooby mistake there.

smiling in pain

  • I got some problems with getting Chakra-UI to dark mode since this was the first time I used Chakra-UI, but a bit of a googling caught me up to the speed. Chakra-UI was beginner-friendly and there is a great community around it. I used chakra templates components for creating dashboard and other components since it gives a rich set of components out of the box, and then I tweaked them a little to match the theme.

Further implementations โ˜„๏ธ

  • Implement handling multiple discord servers , since currently we can only have one discord server per user.

  • Implement polls that expires after a given time , so that after a given time it will automatically end from users voting.

  • Implement custom poll message templates, so that users can change it to a more suited text based on the server.

Info โ„น๏ธ

App Demo Disco-poll

Client repo

Sever repo

  • Thanks for reading till the end
  • I value your opinions, and appreciate you taking the time to share your thoughts.
  • So long ๐Ÿ™Œ
ย 
Share this