Projet abandonné
lors de la fermeture du serveur discord associé.
DiscordBot Prerequisites python >= 3.9 pip
How to setup pip install -r requirements.txt
How to run in development mode python bot.py
or
ENV_FOR_DYNACONF=development python bot.py
How to run in production mode ENV_FOR_DYNACONF=production python bot.py
don't forget to add : -secrets file -discordbot.json -database
This repo is a template for easy creation of maintainable Python Discord bots. https://github.com/DenverCoder1/discord-bot-template
The library used is Nextcord, a maintained fork of Discord.py.
Nextcord documentation: https://nextcord.readthedocs.io/en/latest/
📺 Python Discord Tutorial: https://www.youtube.com/playlist?list=PL9YUC9AZJGFG6larkQJYio_f0V-O1NRjy
Click "use this template" at the top of this repo and follow the instructions, or alternatively, initialize a git repo and copy the template files into the directory.
# Create a new folder (replace my-discord-bot with your bot's name)
mkdir my-discord-bot && cd my-discord-bot
# Initialize the folder as a git repository and copy the template files
git init
cp ../discord-bot-template/* .
To run your bot, you'll need a token and other secrets set in a .env
file.
Create a file called .env
and place it in the root of your project.
(You can do this by creating a copy of .env.sample
and renaming it to .env
)
The contents should look something like this (where the part after =
is the token you received from the Discord Developer Portal)
DISCORD_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
If you require additional API keys or variables specific to an environment, they should also be added here. You can access them by adding a line such as GUILD_ID = os.getenv("GUILD_ID", "")
to config.py
.
runtime.txt
and Procfile
are used for Heroku configuration and can be deleted in case you do not plan on hosting there.
Heroku setup tutorial: https://www.youtube.com/watch?v=EreE-0hQibM
IDE config such as the .vscode
folder do not normally belong on GitHub since they are often specific to a particular environment. To make sure GitHub will ignore the .vscode
folder uncomment the line at the end of the .gitignore
.