Discord Movie Voting Bot

The Problem:

A Discord friend group that I’m a part of started watching movies on a weekly basis. The problem is that we did not have a unified way to pick a movie, and each week would be a different online survey/polling website. Sometimes a person’s movie suggestion would accidentally be left out of the voting pool for that week, and getting people to engage with outside websites is always a struggle.

The Goal:

I wanted to create a tool (bot) that could be integrated to our discord channel through the Discord APIs that would allow us to create, store, vote for, and moderate movie lists for our weekly movie.

The Solution:

Using Node.js and Discord’s public Discord.js libraries, I created a tool that allows users to add and vote for movies with a list stored locally on my PC (which is also where the Node instance runs). The goal was not to create a marketable or “industrial-grade” bot, so many things were build with the understanding that the bot can only run on our single server. However, this simplified the data handling and storage quite a bit.


Here is a list of the current commands via the !help command:

Most of the interaction with the bot is through text commands (prefaced with !movie). There was a feature that used reactions on Discord embeds to vote for movies, but with longer and longer movie lists coupled with the slowness of Discord to populate reactions, I decided to add a separate vote feature that allows a user to vote by typing the name of the movie.

All users can add movies, add reference links for movies, view the list of current and watched movies, and vote for a movie. Users are limited to one vote at a given time (to prevent an unnecessary amount of ties), and voting for a new movie will remove all of their previous votes. Furthermore, to prevent stale votes, each vote stores a timestamp for when it’s added and is automatically removed after a configurable time.

Users can also be specified as admins for the bot, which allows them access to extra commands, such as the ability to move movies from the main list to the watched list, add/remove other admins, remove movies from the list, or move movies back from the watched list to the main list

Source Code:

Feel free to use this code however you want. I won’t claim that it’s bulletproof, but it works for my local application, so use at your own risk.