April 14, 2023

is it possible/difficult to make a discord bot in Python?

I conducted research on the possibility and difficulty of creating a Discord bot in Python by examining various Reddit discussions and posts. The sources I analyzed included discussions about the ease of using Python for creating Discord bots, comparisons between Python and other programming languages, and tutorials on setting up Discord bots using Python. There was general consensus that creating a Discord bot in Python is possible and not too difficult for beginners, but opinions varied on whether Python or JavaScript is the better choice for creating Discord bots.

Words

473

Time

2m 13s

Contributors

119

Words read

8.2k


Jump to research

Composed by

Profile picture

Anonymous Walrus

Views

1842

Have an opinion? Send us proposed edits/additions and we may incorporate them into this article with credit.

Python as a Suitable Language for Discord Bots

According to a Reddit discussion, it is possible to create a Discord bot in Python that can roll numbers, send pictures, and track points. Python is considered better suited for someone who is just starting out with programming. The Discord.py module can be used along with a Python compiler to create Discord bots, and it is recommended to use Python 3.7 or higher as Discord.py no longer supports anything lower. Python is also considered a good language for getting into Discord bot basics, as the discord.py library is straightforward and easy to learn.

Comparing Python and JavaScript for Discord Bots

While some users found JavaScript easier than Python, others argued that Python is more beginner-friendly. One user mentioned that JavaScript has solid documentation and numerous node modules, making it a good choice for those with prior experience. However, another user pointed out that Python has an equally organized and consistent library, Discord.py. Some users preferred Python over JavaScript because it has a wide array of modules that can be downloaded and used in Python scripts. In a discussion comparing discord.js and discord.py, one user claimed that the documentation for discord.js is easier to understand, and it has more support and examples of code available. However, several people in the same discussion stated that the choice ultimately depends on the language that the user is comfortable with and what they want to achieve with the bot.

Hosting Discord Bots

For hosting Discord bots, users have suggested various options such as AWS, Heroku, GCP, Azure, DigitalOcean, and even Raspberry Pi. AWS can be used to host a Discord bot in Python, but its complexity and pricing might not be suitable for beginners or small projects. A DigitalOcean droplet or a Raspberry Pi could be better alternatives for smaller projects or when AWS is not a good fit. In conclusion, it is possible and not too difficult to create a Discord bot in Python, especially for beginners. Python and JavaScript both have their advantages and limitations, but the choice ultimately depends on the user's comfort level with the language and their objectives for the bot. Various hosting options are available, and users can choose the most suitable one based on their project size and experience level.

Jump to top

Research

Source: "Hosting a Discord bot using AWS" (from reddit, r/aws)

  • A Discord bot in Python can be hosted on AWS Lambda and DynamoDB.
    • Reddit users didn’t completely agree on whether using Lambda would work for all bot functions or whether a virtual machine would be necessary.
    • Both options offer a free tier.
    • Lambda is typically event-driven, but a cloudwatch scheduled event could be used to trigger it.
    • A virtual machine would respond to an event such as a HTTP request or cron.
  • Officially endorsed Discord libraries can be used to write the bot.
  • Hosting options include Fargate or a free-tier EC2 instance for high availability.
    • An autoscaling group can also help ensure a server is always running.
  • Posting messages on a schedule can be done using EventBridge and SQS.
  • For small databases, DynamoDB would be suitable and free.
  • Some users suggested a DigitalOcean droplet or even a Raspberry Pi for smaller projects or when AWS is not a good fit.
  • AWS can be complicated and pricing is not straightforward, so it might not be the best choice for beginners or small projects.

Source: "im searching for a discord.js vs discord.py com..." (from reddit, r/discordbots)

  • A comparison was sought between discord.js and discord.py.
    • One person stated that they found JS more intuitive and versatile than Python, but offered knowledge and support for either.
    • Another person said that Python is easier to write and understand, but less well-documented; this claim was contested by someone else.
    • Several people said that JS is easier to read or more intuitive, but opinions varied.
    • One person found python easier to learn than JS.
    • One user recommended learning both languages to determine which one feels more intuitive.
    • Someone said that python is simpler to learn, but less flexible or powerful than JS.
    • One user suggested learning discord.js, suggesting that it doesn’t require knowledge of the whole language or library.
    • Another user emphasized that it depends on what the user wants to accomplish with the language and library.
  • discord.py is still active and safe.

Source: "discord.py vs discord.js vs discord.net" (from reddit, r/CodingHelp)

  • Reddit post asking for advice on the best library for building a Discord bot
    • Asks about differences between python, node.js, and .net languages
    • Article linked in post discusses differences between discord.py and discord.js
    • Concerns raised about discord.js not having a dedicated class for command handling
      • Posters unsure if this means limitations or just more difficult to implement
    • Responses indicate that there is no definitive answer on which is the best library for building a Discord bot
      • Suggestion to start with language the poster is already familiar with
      • Setting up projects in Python and JavaScript is relatively simple and the best way to determine which library to use

Source: "[Discord Bot] Choosing the correct programming ..." (from reddit, r/Discord_Bots)

  • According to a reddit user’s post two years ago, there are three major coding languages for creating Discord bots: JavaScript, Python, and C#.
    • Python offers “discord.py” while the main package for NodeJS is “discord.js.”
    • A reddit user claims that the documentation for “discord.js” is easier to understand than for “discord.py.”
    • NodeJS may offer more support and examples of code.
    • Several people commented that NodeJS is as stable as Python.
  • One user recommends choosing a language according to one’s own preferences.
  • One user suggests choosing the language you are most familiar with.
  • None of the respondents suggest that creating a Discord bot in Python is difficult.

Source: "[Python][Nextcord] Seeking help with interactio..." (from reddit, r/Discord_Bots)

  • Relevant info on making a Discord bot in Python:
    • None
  • Relevant info on difficulty of making a Discord bot in Python:
    • None
  • Relevant info on using interaction checks in a Discord bot:
    • To ensure that the code is only moving forward if the person who clicked the button is the command user, use an if statement that checks the interaction.user variable.
    • A useful tutorial on button interactions in Discord bots can be found at the provided YouTube link.

💭  Looking into

What resources are available to help me learn more about Discord bot development?

💭  Looking into

What is the best way to debug errors in a Discord bot?

💭  Looking into

What features does Next Cord offer compared to other Discord bot development tools?

💭  Looking into

What are the advantages and disadvantages of using Discord.js?

💭  Looking into

What are the minimum requirements for using Discord.py?

Source: "What is easier to develop bots with: Javascript..." (from reddit, r/Discord_Bots)

  • “What is easier to develop bots with: Javascript or Python?”
    • One person recommends choosing JavaScript if you have prior experience because of its solid documentation and countless node modules.
    • Another person mentions that while Discord.js is a popular library, it makes previous code useless on every major update and it is not recommended.
    • A third person points out that Discord.py is equally organized and consistent and was actually discontinued then recontinued because other libraries were inconsistent and not good alternatives.
      • Yet another user links a Gist where it is announced that Discord.py is being recontinued because Discord is deprecating API versions 6 and 7 which the latest version of Discord.py (v.1.7.3) uses and there’s no good alternative to it.
    • A few people prefer Python over JavaScript and recommend it because it has a wide array of modules that can be downloaded and used in Python scripts.
      • One of them mentions that modules help provide a wide range of functionality with Python, which is not possible in JavaScript, but JavaScript is more efficient in terms of computer load.
      • Another user personally enjoys using the Python library way more than Discord.js:
        • Type contracts make a huge difference for them and cogs help them organize their code in a much better way.
        • They found that making a help command was way more intuitive and easy with Discord.py because the docstrings can be used as the help message, meaning your help command is also written as you document your code.
    • A user points out that the choice ultimately depends on the language that you want to work with and what you are comfortable with.
    • Another person recommends starting with smaller projects if you want to make a bot using Python and suggests to stick to what you know for a moment while learning the basics of Python if you don’t have any.
    • Python is recommended by some as having far less boilerplate and generally far fewer lines of code compared to JavaScript.
    • Another person suggests that if you have experience with programming or if you have no experience at all, you should go with Python because starting programming with JavaScript is like learning to ski during summer.
    • Lastly, someone suggests using .NET.

Source: "How to create a Discord bot with Python: Part 1..." (from reddit, r/Python)

  • Webpage:
    • URL: https://youtu.be/XUCITCMSpIk
    • Two year old tutorial video on creating a Discord bot with Python.
    • Reddit comments on the video post:
      • Python is good for getting into Discord bot basics as discord.py is straightforward.
      • The basics are reasonably simple and easy to learn.
      • The video series is for beginners.
      • Recommended for people trying to learn more.
      • Creating Discord bots is a fun project.
      • Discord.py library is good for getting into bot creation.
      • Raspberry Pi is suggested to run bots.
      • OOP design is essential to learn before creating a bot.
      • Functional programming is suggested to new programmers.
      • Heroku, GCP, AWS, and Azure are suggested for hosting bots.
      • Unhandled exceptions can cause bots to go offline.
      • There’s plenty of competition in tutorial videos on creating Discord bots.

Source: "How hard is it to create a bot?" (from reddit, r/Discord_Bots)

  • According to a Reddit user, it is possible to create a discord bot that rolls numbers, sends pictures, and tracks points.
    • The user suggests that any programming language can accomplish this, but only the user’s skills and creativity would limit them.
    • JavaScript and Python are both suitable for beginners and have mature discord modules to bring the ideas to life.
    • Python is better suited for someone who is just starting programming.
  • Another Reddit user created their own discord bot in JavaScript, which they find easier than Python because it has fewer additional steps.
    • This user posted the link to the GitHub repository that holds all the code for their bot and includes directions for how they accomplished this.
    • The functionalities that you can create are endless, so it is important to use all available resources to learn how to add those functionalities.
  • A different Reddit user added that no need of setting up another environment to run Python scripts; only a compiler and the Discord.py module are required.
    • The user recommends using Python 3.7 or higher as Discord.py no longer supports anything lower.

Source: "Is making your own bot hard?" (from reddit, r/discordapp)

  • Making a Discord bot would depend on the complexity of the bot; some tasks are easier with programming experience, and some aren’t.
    • Programming experience would be recommended.
  • Special programs must be downloaded to program the bot, depending on the language used.
    • For Python, a Python interpreter is necessary.
  • Personal preference is discord.js, which has a user-friendly website and community.

Source: "Python discord.py Bot - Setup" (from reddit, r/Discord_Bots)

  • The webpage provides a tutorial on making a discord bot with Python.
  • Some users suggest migrating to other modules like Next Cord or Pycord due to limitations in Discord.py.
  • A user mentions that Discord.py is back in active development and has implemented most of the new features.
  • A discussion on the use of timeout function in Discord.py takes place.
  • Overall, the webpage provides helpful information on creating a Discord bot with Python, and mentions the limitations and alternative options available.

💭  Looking into

What is the best way to make a Discord bot in Python?