How to Technology

How To Add Bots To Your Discord Server

How To Add Discord Bots
Written by irfansadiq786
If you run a Discord server, you’ve got got a extensive type of alternatives to offer neat functions to your players. One of these functions is the addition of bots. Customizing your server is straightforward after you discover ways to upload those bots.

What Are Discord Bots?

Bots are truly pc applications that have interaction with human beings (and on occasion with different bots) to carry out sure capabilities routinely. A internet site that has a beneficial chat window without delay opens up providing to speak with you approximately their product or service; that’s a bot. If you operate Reddit, you notice bot interactions (beep! boop!) all of the time.

Bots may be beneficial or infuriating, relying on their purpose, their design, and the way they may be deployed. On Discord, bots offer a number of effective and now no longer-so-effective functions to the network at the server wherein they “live.” You can upload bots on your Discord server that assist you to mild contributors or make your server a touch greater particular and fun.

For example, there are bots that play music, bots that provide fun memes on request, bots that fetch your recreation stats for you, and bots that play a noisy air horn noise at the channel whilst brought about to do so.

How To Add Bots To Discord Server

How To Add Bots To Discord Server

Finding Good Bots

The Discord global is complete of bots; there are heaps of freely-to be had bots out there. There’s a listing of a few stupid and semi-beneficial bots here in case you like, however greater severe bots may be located on the Carbonitex internet site, that is appeared as one of the satisfactory repositories of Discord bots around. Another legit repository for Discord bots is called, truly enough, Discord Bots. For the really hardcore, a GitHub look for Discord bots will locate pretty much the whole thing that it’s miles within side the public view.

How to Create a Discord Bot Account

In order to paintings with the Python library and the Discord API, we need to first create a Discord Bot account.

Here are the step to growing a Discord Bot account.

1. Make certain you’re logged directly to the Discord internet site.

2. Navigate to the utility page.

3. Click at the “New Application” button.

4. Give the utility a call and click on “Create”.

5. Go to the “Bot” tab after which click on “Add Bot”. You will should verify through clicking “Yes, do it!”

Keep the default settings for Public Bot (checked) and Require OAuth2 Code Grant (unchecked).

Your bot has been created. The subsequent step is to replicate the token.

How to Invite Your Bot to Join a Server

Now you need to get your Bot User right into a server. To do this, you need to create an invitation URL for it.

Go to the “OAuth2” tab. Then select “bot” below the “scopes” section.

Now pick out the permissions you need for the bot. Our bot goes to especially use textual content messages so we do not want quite a few the permissions. You might also additionally want greater relying on what you need your bot to do. Be cautious with the “Administrator” permission.

After deciding on the suitable permissions, click on the ‘reproduction’ button above the permissions. That will reproduction a URL which may be used to feature the bot to a server.

Paste the URL into your browser, pick out a server to ask the bot to, and click on “Authorize”.

To upload the bot, your account needs “Manage Server” permissions.

Now that you have created the bot user, we’re going to begin writing the Python code for the bot.

How to Code a Basic Discord Bot with the discord.py Library

We’ll be the usage of the discord.py Python library to put in writing the code for the bot. discord.py is an API wrapper for Discord that makes it less complicated to create a Discord bot in Python.

How to Create a Repl and Install disocrd.py

You can increase the bot in your neighborhood pc with any code editor. However, on this tutorial, we’re going to be the usage of Repl.it as it will make it less difficult for all people to comply with along. Repl.it’s miles a web IDE that you could use to your net browser.

Start through going to Repl.it. Create a brand new Repl and pick out “Python” because the language.

To use the discord.py library, simply write import discord on the pinnacle of main.py. Repl.it’ll routinely deployation this dependency while you press the “run” button.

If you opt to code the bot locally, you could use this command on MacOS to put in discord.py:

python3 -m pip deployation -U discord.py

You might also additionally should use pip3 rather of pip.

If you’re the usage of Windows, you then definately need to use the subsequent line rather:

py -3 -m pip deployation -U discord.py

How to Set Up Discord Events for Your Bot

discord.py revolves across the idea of events. An occasion is some thing you pay attention to after which reply to. For example, whilst a message happens, you’ll get hold of an occasion approximately it that you could reply to.

Let’s make a bot that replies to a particular message. This easy bot code, together with the code explanation, is taken from the discord.py documentation. We may be including greater functions to the bot later.

Add this code to main.py. (You can call the report some thing else in case you like, simply now no longer discord.py.) I’ll give an explanation for what all this code does shortly.

About the author

irfansadiq786

Leave a Comment