First interactive Discord bot!
👤 *Created by
Ckemill
*
- Have NodeJS installed.
⚠️ Recommended to have version LTS16.x.x
to avoid posible errors.⚠️
git clone https://github.com/Ckemill/Perritu.git
npm install
Create a .env
file and e introduce the data require as below.
.env
file with no one.
BOT_TOKEN = "Bot's token"
PREFIX = "Desired Bot's prefix"
STATUS = "Bot Status Text"
STATUS_TYPE = "State Type" #these can only be Playing, Streaming, Listening, Competing.
COLOR = "the color of the embed (HEX)"
OWNER_ID = "The bot owners ID separated with spaces"
When you have the bot (.env)
configured and the node modules installed, you can start it with node .
In the content of /src/commands
, you'll be able to find the categories of the commands, to create a category, it is as simple as creating a folder within this path, for example:
/src/commands/newCategory
To create commands within this category, you will need to create a file with the command name with the format .js
, for example:
/src/commands/newCategory/announcement.js
Then, you will have to create the structure (object) of the command with the following template:
module.exports = {
DESCRIPTION: "Serves to perform an announcement.", //command description
ALIASES: ["ad", "advertisement"] //command name aliases
PERMISSIONS: ["KickMembers", "BanMembers"] //permissions the user will need to run the command
BOT_PERMISSIONS: ["KickMembers", "BanMembers"] //permissions that the bot will need to execute the command
OWNER: true, //If true, only the owners of the bot will be able to execute the command
execute(client, message, args, prefix){
//command execution
return message.reply(`**This is an announcement!**`);
}
}
⌚ The command name will be equal to the file name.
❗Aliases
, both Permissions
& Owner
can be removed from the object if no use needed.
To execute the command that we have created, it is as simple as executing in our bot <Prefijo>announcement
.
In the content of /src/slashCommands
, you'll be able to find the categories of the commands, to create a category, it is as simple as creating a folder within this path, for example:
/src/slashCommands/newCategory
To create commands within this category, you will need to create a file with the command name with the format .js
, for example:
/src/slashCommands/newCategory/announcement.js
Then, you will have to create the structure (object) of the command with the following template:
const {SlashCommandBuilder} = require('discord.js');
module.exports = {
CMD: new SlashCommandBuilder()
.setDescription("Serves to perform an announcement."), //command description
//you can find more methods in https://discordjs.guide/creating-your-bot/slash-commands.html
PERMISSIONS: ["KickMembers", "BanMembers"] //permissions the user will need to run the command
BOT_PERMISSIONS: ["KickMembers", "BanMembers"] //permissions that the bot will need to execute the command
OWNER: true, //If true, only the owners of the bot will be able to execute the command
execute(client, interaction, prefix){
//command execution
return interaction.reply(`**This is an announcement!**`);
}
}
⌚ The command name will be equal to the file name.
❗Both Permissions
& Owner
can be removed from the object if no use needed.
To execute the command that we have created, it is as simple as executing in our bot /announcement
- ✅ Scalable
- ✅ Organized
- ✅ Slash & Prefix commands
- ✅ Reloads the bot without having to restart, avoiding possible spams to the Discord API
All donations will be used to improve the service of Perritu. Thank you!
Tested and working correctly on NodeJS version 18.12.1
& npm version 8.19.2