Scuffed's Discord.JS template is a simple template to make discord.js bot setup easier, this includes a config.json file where you'd input token, status, etc. It also includes code snippets to make it eaiser.
- NPM
- Node.JS
- Basic JavaScript knowledge
To setup this template, follow these steps
- Download the .zip from here
- Drag the .zip and unzip it inside a file
- Make a new NPM "project" via the
npm init
command - After step 3, download discord.js via the
npm i discord.js
command - Voila!
- The config file contains all the configuration stuff for your bot.
{
"token": "",
"status": "",
"username": ""
}
- Token: Paste your bot's token into the pair of
" "
- Status: Paste your bot's status you'd like it to have, this is optional EXAMPLE:
To see the list of code snippets avaliable in this template, you can type "ScuffedTemp" and they will all come up *EXAMPLE:
I'll go over ONE snippet.
client.once(Events.ClientReady, async c => {
console.log(`Ready! Logged in as ${c.user.tag}`);
const command = new SlashCommandBuilder()
.setName('ping') // Name
.setDescription('Ping Pong command'); // Description
// Register the command with Discord
const commandData = command.toJSON();
await client.application.commands.create(commandData);
});
// Handle the interaction
client.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
});
- NOTE --> THe client.once stuff is already present in the base index.js, same with client.on
const command = new SlashCommandBuilder()
--> This line of code initiates a new command, change the command part to any name, you'll need it later so make the name meaningful.setName('ping')
--> This line sets the command name.setDescription
--> This line sets the command's descriptionawait client.application.commands.create(commandData)
--> This line registers the command into discord- All the stuff under client.on manages the event stuff for the command, when you make multiple commands you put them under there.
If you'd like to contribute to this repo, you may, open a pull request and I may accept it. You'll be added to the list of helpers
If you'd like to contact me for help --> ScuffedItalian#5158
Link to the discord.js documentation --> here Link to a good discord.js tutorial series --> here This is a really good tutorial and I advise watching it HEAVILY!