DEV Community

Ekcum
Ekcum

Posted on • Edited on

2

First Setup to programm a discord bot in python

Hey, you want to create a bot?
Then you are in the right post for that.
Questions are always welcome and I wish you happy coding.

As a smallsidenote: I wrote this to get myself and the world a good explanation of what i programmed. The bot developed in this project is a multipurposebot called ModNPC. You can add him by this clicking this: Just a link.

In this small article we will talk about the basics to create a bot and what you need to develop a bot.

First you need to create a bot. Do this on this website:
https://discord.com/developers/applications
Create a new bot. After that get your token from this menu:
Image description
Please save it and dont share it with anybody u dont trust. It can easily cause server to collapse. After that i recommand, activating this checkboxes:
Image description
Also activate the permissions your bot need to operate normally:
Image description

For developing your bot u will debug a lot. For this create an own discord server. After that invite your bot over the developer portal on this server:

Image description

Dont forget to activate in the first checkbox bot. After that you choose which rights your bot should have with this link. After this just copy the link, enter in your browser and add the bot to the right server.

For programming a bot in python, you need to install these libs by entering this in your terminal:
pip install discord.ext.context
py -3 -m pip install -U discord.py update-command: pip install --upgrade discord.py

If you prefer to do it in rust, i recommand using serenity-rs and the poise framework

This is the basic stuff you need to develop a bot.

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay