DEV Community

Mannu
Mannu

Posted on • Updated on

#1.Introduction To Discord.py

Introduction and basic stuff

Hey Guys!
I am Mannu from India and from today on we are gonna start discord.py and discord.ext...
Its great thing to learn coz creating our own bot that can do what u want is something like a dream which we will be making a reality.

I will create a new repository where I will publish all the code.

So let's start by setting up our files, well nm just create a normal python file (main.py) and let's get started.

1.So the first step for us is to install discord.py.Run the following command in terminal



pip install discord.py


Enter fullscreen mode Exit fullscreen mode

and please don't comment saying pip is not recognized or something 💀

Now as our discord.py is installed let's get into the code.
we will be using discord.ext for this tutorial.

2.Now leave the codebase for a while. Go to this link and click on the new application button on top right corner

Create Application

You may need to login

Name Anything you like to ur application and click create button.

Setting up application

Do Some Customization if u wanna do in general like changing pfp or sum
3.Then on the right side click on this Bot Panel

Bot

Then U will See some stuff like this

Bot Panel

Well our bot username will be different, U can change it with whatever u want. Then Go down and enabled these Privileged Gateway Intents

Intents

These are some intents that our bot need to function.

Go to the top and click on the reset token

Token
then click on copy and copy it. (I'll reset this token it was just to show uall )
Save that token somewhere you will need that to control your bot.
NOTE: PLEASE DO NOT SHARE YOUR BOT TOKEN TO ANYONE.
4.Then go to OAuth2 ==> URL Generator

OAuth2 Tab

Select Bot and Applications.commands in scopes and give the required permisions, I am giving admin permission for now and you can also give that but don't give administrator to bot while production.
scopes and perms

Copy the Generated URL and paste it into any any empty tab and the bot in your server.
Generated URL

I created a server named discord.py tutorial specially for this tutorial you can do join the server and contact me there.
Inviting Bot
Click on Continue and Authorize

Inviting bot
And there you go, successfully created a bot and invited it into the server.

Invited

Invited

Well this is just beginning.....

I'll be publishing more tutorials on discord.py soon

Up next we will learn how to make our bot online will create our first command.

Till then Bye Bye and Cya
do like and make sure to follow...

Top comments (2)

Collapse
 
madhavseth profile image
Madhav

Keep up the good work

Collapse
 
ibnereham profile image
ibnereham

Perfection