Welcome to the Pitchlabs Community Bot! 🚀
- Head over to the Discord Developer Portal and click on
New Application
. - Move to the
Bot
tab:- Turn off
PUBLIC BOT
to restrict bot access. - Enable
Privileged Gateway Intents
for enhanced functionality.
- Turn off
- Navigate to the
OAuth2
tab and generate a URL:- Under
SCOPES
, selectbot
andapplications.commands
. - In
BOT PERMISSIONS
, chooseAdministrator
. - Copy the generated URL and either paste it in your browser or directly into your Discord server. Click on the link to invite your bot.
- Under
-
Start by creating a
.env
file. You can use the provided.env.example
as a template. Then fill in the variables with the necessary values.DISCORD_BOT_TOKEN
is obtained from theBot
tab. Click onReset Token
and thencopy
to get the token value.
- Ensure you have Node.js installed on your system.
- Install the required packages by running:
npm install
- For production, use:
npm install --production
.
- Launch your bot in development mode:
npm run dev
- For production, use:
npm start
.
-
Inside the
/features
directory, there are files that are automatically executed using theinitializeFeatures
function inindex.js
. These files are essential for expanding the bot's functionality. Each feature should be contained within its own file, making it easier to manage and maintain the bot's capabilities.-
Adding New Features: If you want to add a new feature to the bot, create a new JavaScript file in the
/features
directory. The content of this file should look like this:export const initialize = () => { // Your feature logic goes here };
Inside the
initialize
function, write the code for your new feature. This is where you'll define what the feature does and how it interacts with your Discord bot.
-
-
Creating New Commands: To create a new command for the bot, follow these steps:
-
Add Command to
commandList.js
: Inside the/commands
directory, locate thecommandList.js
file. Add a new entry to thecommands
array with the format:{ name: 'commandName', description: 'Description of the command, maximum 100 characters.', }
Replace
'commandName'
with the actual name of your command and provide a brief description. -
Create Command Handler File: Inside the
/commandHandlers
directory, create a new JavaScript file with the same name as your command (e.g.,commandName.js
). -
Implement Command Logic: In the newly created command handler file, implement the logic for your command. Export an asynchronous function with the same name as the file (e.g.,
commandName
) that accepts theinteraction
object as a parameter. Here's an example structure:const commandName = async (interaction) => { // Command logic goes here }; export default commandName;
Implement the desired functionality of your command within the
commandName
function.
The bot dynamically handles incoming commands based on the registered commands in
commandList.js
. There is no need to modify the core code for each new command. Ensure the command incommandList.js
matches the filename incommandHandlers
to maintain consistency. -
- Explore Discord's official documentation: Discord Docs
- Dive into the Discord.js guide: Discord.js Guide
Feel free to reach out if you have any questions or need assistance. Let's make our Discord experience even more exciting! 🎉