A Discord bot for my private server.
Before requesting support, you should know that this requires you to have at least a basic knowledge of Python and the library is made for advanced users. Do not use this if you don't know the basics. Here's a link for resources to learn python.
If you need some help for something, do not hesitate to join the Discord server for discord.py here.
Slash commands can take some time to get registered globally, so if you want to test a command you should use
the @app_commands.guilds()
decorator so that it gets registered instantly. Example:
@commands.hybrid_command(
name="command",
description="Command description",
)
@app_commands.guilds(discord.Object(id=GUILD_ID)) # Place your guild ID here
- Clone/Download the repository
- To clone it and get the updates you can definitely use the command
git clone
- To clone it and get the updates you can definitely use the command
- Create a discord bot here
- Get your bot token
- Invite your bot on servers using the following invite:
https://discord.com/oauth2/authorize?&client_id=YOUR_APPLICATION_ID_HERE&scope=bot+applications.commands&permissions=PERMISSIONS (
Replace
YOUR_APPLICATION_ID_HERE
with the application ID and replacePERMISSIONS
with the required permissions your bot needs that it can be get at the bottom of a this page https://discord.com/developers/applications/YOUR_APPLICATION_ID_HERE/bot)
To set up the bot there is now a config.json file where you can put the needed things to edit.
Here is an explanation of what everything is:
{
"prefix": # The prefix for the bot,
"permissions": # The permissions integer from the Discord Developer tab for your bot,
"bot_token": # The token for your bot,
"bot_application_id": # The application ID of your bot,
"sync_commands_globally": true,
"owners": [],
"moderators": []
}
There's also a .env
file required, with the following keys:
BOT_TOKEN="Your Bot Token from Discord Developer Portal"
RS_API_TOKEN="Random Stuff API Key"
RAPIDAPI_TOKEN="RapidAPI Key"
To start the bot you simply need to launch, either your terminal (Linux, Mac & Windows), or your Command Prompt ( Windows) .
Before running the bot you will need to install all the requirements with this command:
python -m pip install -r requirements.txt
After that you can start it with
python bot.py
Note You may need to replace
python
withpy
,python3
,python3.11
, etc. depending on what Python versions you have installed on the machine.
This repository is based off of a template from kkrypt0nn.
See the license file for more information.
This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.