To make it easier for you, I have broken everything down into stages.
- Click here and you download python 3.12.4
- Be sure to check the box next to Add Python 3.12.4 in PATH and proceed with further installation
Also: After installing Python, you can also install Visual Studio Code to edit bot files using this link
Create a new bot on the website Discord Developers Portal
- Go to site
- Click on the button
New Application
- Name the robot and click
Create
- Select a tab
Bot
- Click
Reset Token
and save it somewhere (After reloading the page, the token will disappear and will have to be recreated if lost)
In the Bot
tab, enable the following checkboxes
Public Bot
- Means the bot is public and can be added by other people to their Discord servers.Presence Intent
- Allows the bot to track users' presence, including their real-time status (e.g. online, away, busy) and activity (e.g. playing a game).Server Members Intent
- Allows the bot to obtain information about server members, such as names, nicknames, roles, etc.Message Content Intent
- Allows the bot to receive information about the content of messages, including text and attachments.
We write this command in cmd pip install disnake
Customizing the bot for yourself
Online
status=disnake.Status.online
Offline
status=disnake.Status.offline
Do not disturb
status=disnake.Status.dnd
Not active
status=disnake.Status.idle
Playing
activity=disnake.Game(name="game")
Looks
activity=disnake.Activity(type=disnake.ActivityType.watching, name="youtube")
Listens
activity=disnake.Activity(type=disnake.ActivityType.listening, name="music")
Streaming
activity=disnake.Streaming(name="game", url="https://www.twitch.tv/nickname") #if you remove the url argument, the button simply won’t appear, but everything will work
Competes in
activity=disnake.Activity(type=disnake.ActivityType.competing, name="creating a bot")
This parameter means adding a test server on which slash commands will be updated immediately. If you add a large number of identifiers, the bot will start slowly, we recommend adding no more than 3
To add your server there, write this:
test_guilds=[id]
To add several servers write like this
test_guilds=[id, id]
Important - If your server ID is not there, the slash command will appear/update only 10-15 minutes after it is added/changed
Cog - bot module where commands are stored, you can create as many cogs as you like (Cleaning, Entertainment, etc.)
Token - an encrypted Discord key with which the bot is authorized
Import is a mandatory thing that adds a lot of useful things to the code, example below
import disnake
from disnake.ext import commands
Event - a trigger that is activated by some action, for example on_ready - the bot is turned on (ready)
further look at the files, there I will post examples!
upd 2024 29.06 & upd 31.06 upd. 01.06