How to Make a Discord Bot with Python Host for Free 24/7 New Bot 2023

 


Discord is a popular platform for online gaming, community building, and socializing. Discord bots are automated programs that can perform various functions and help you manage your server. In this article, we will show you how to make a Discord bot with Python and host it for free 24/7 in 2023.


Step 1: Setting Up the Discord Server


To make a Discord bot, you need to have a Discord account and a server. Once you have created your account and server, you need to set up the roles and permissions.


Go to the server settings, then roles. By default, you will see the "everyone" role. Turn off all the permissions for this role, as you don't want everyone to have access to everything in your Discord. Next, create a new role for your members and name it something like "test members". Give it a green color and turn on the feature to display role members separately from online members. Add one more role for yourself as the owner of the server, give it a blue color, and turn on the feature to display role members separately from online members. Make sure to put the owner role above all the other roles, as the owner role has the ability to manage the roles beneath it.


Next, create a new category and name it "Start Here". Create two channels in this category, a "Welcome" channel and a "Rules" channel. Edit the category's permissions section and turn on the permissions "view channels", "create invite", and "read message history". These permissions will be automatically applied to both channels, but add one more permission to the "Rules" channel which is "ADD reactions", so users can react in order to join the "test members" role.


Move on to the next category "Text Channels". In this section, you should add the "test member" role to this category and enable some permissions for your members, such as "view channels", "send messages", "use emojis", and whatever you like to allow your members to do. Before moving to the next step, add some few channels, such as a "Memes" channel and a "Tech" channel.


You have now set up all the roles and permissions in your server.


Step 2: Creating a Discord Bot


To create a Discord bot, you need to create a new application on the Discord developer portal. Name the application and click on the "bot" option from the list on the left side. Add a bot and after naming it, copy the token for further use. You also need to enable privileged Gateway intents, as your bot needs to access privileged intents.


Next, create an invite link for your app. Check the bot option and give your bot the permission as administrator. Scroll down a little, copy the given URL, and open it in a new tab. Select your server and click on authorize. Congratulations, you have successfully created your Discord bot!


Step 3: Coding the Discord Bot


To make things easier for you, we have created a multi-purpose Discord bot which has many features. You can find the code for the bot on GitHub. Click on "Code", then "Download ZIP", extract the files, and open the folder.


The first thing you need to do is install the requirements. Go to the path of this folder and type "CMD". Then, type the following command: "pip install -r requirements.txt". This will install all the libraries needed at once.


After that, type "code ." and your text editor will open. We are using Visual Studio Code, but you can use the one you prefer. This is our Python file

Now that you have successfully created and coded your Discord bot, the next step is to host it. Hosting your bot means that it will be accessible and active 24/7, even when your computer is turned off.


There are many hosting services available, but in this tutorial, I will show you how to host your bot for free using Heroku.


Create a Heroku account: Go to the Heroku website and create a free account.


Install Heroku CLI: After creating your account, download and install the Heroku CLI tool on your computer.


Connect Heroku to your Github repository: Upload your bot code to Github, and then connect your Heroku account to your Github repository.


Create a new Heroku app: Once your account is connected to your Github repository, create a new app on Heroku.


Deploy your bot to Heroku: After creating your app, deploy your bot to Heroku using the Heroku CLI tool. Make sure to follow the instructions carefully.


Set up worker dyno: Finally, set up a worker dyno on Heroku to keep your bot active 24/7. This can be done through the Heroku dashboard.


Congratulations! You have successfully created, coded, and hosted your own Discord bot with Python. You can now add your bot to your Discord server and start using it to perform various functions, such as welcoming new members, moderating chat, and filtering inappropriate language.


Remember to always keep your bot's token safe and never share it with anyone, as it can be used to gain unauthorized access to your Discord server. Happy botting!

watch video tutorial



Next Post Previous Post