Discord.js v13 Template and commands ready to use
To use discord.js install these packages:
npm install discordjs/builders @discordjs/rest discord-api-types fsether you can use the index.js of the repo or code it yourself:
constfs=require('fs');const{ Client, Collection, Intents }=require('discord.js');constclient=newClient({intents: [Intents.FLAGS.GUILDS]});const{TOKEN}=require('./config.json')client.commands=newCollection();// The Bot goes upclient.once('ready',()=>{console.log('Ready!');client.user.setPresence({activities: [{name: 'activity text here'}],status: 'online'});});client.on('interactionCreate',asyncinteraction=>{if(!interaction.isCommand())return;constcommand=client.commands.get(interaction.commandName);if(!command)return;try{awaitcommand.execute(interaction,client);}catch(error){console.error(error);awaitinteraction.reply({content: 'There was an error while executing this command!',ephemeral: true});}});// Logins into the bot accountclient.login(TOKEN);to register slash commands use the deploy-commands.js of the repo
Download the file you wanna include to your bot and credit me in your credits command like:
[COMMAND NAME] provided by: [Copy05](https://github.com/Copy05/)
if you have a package.json file i recomend you adding:
"scripts": {
"start": "node deploy-commands.js && node index.js"
},NOTE: YOU REQUIRE BASIC JAVASCRIPT KNOWLEDGES TO CODE A BOT
The peoples at Discord.js Guide have explained everything perfect: Discord.js Guide