Giter Club home page Giter Club logo

discord.js-template's Introduction

Discord.js-Template

What is Scuffed's Discord.JS Template?

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.

Tutorial

Prequisuits

  1. NPM
  2. Node.JS
  3. Basic JavaScript knowledge

Setup

To setup this template, follow these steps

  1. Download the .zip from here
  2. Drag the .zip and unzip it inside a file
  3. Make a new NPM "project" via the npm init command
  4. After step 3, download discord.js via the npm i discord.js command
  5. Voila!

Config.JSON file

  • The config file contains all the configuration stuff for your bot.
{
    "token": "",
    "status": "",
    "username": "" 
}
  1. Token: Paste your bot's token into the pair of " "
  2. Status: Paste your bot's status you'd like it to have, this is optional EXAMPLE:

Screen Shot 2023-03-29 at 2 30 34 PM

3. Username: this is the username of the bot, this is required to an extent. You can COMPLETLY remove this in the index.js file ***EXAMPLE:***

Screen Shot 2023-03-29 at 2 30 34 PM

Code Snippets

To see the list of code snippets avaliable in this template, you can type "ScuffedTemp" and they will all come up *EXAMPLE: Screen Shot 2023-03-29 at 2 37 24 PM

I'll go over ONE snippet.

Basic SlashCommand 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
  1. 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
  2. .setName('ping') --> This line sets the command name
  3. .setDescription --> This line sets the command's description
  4. await client.application.commands.create(commandData) --> This line registers the command into discord
  5. All the stuff under client.on manages the event stuff for the command, when you make multiple commands you put them under there.

Other

Repo contributions

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

Contact

If you'd like to contact me for help --> ScuffedItalian#5158

Links

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!

discord.js-template's People

Contributors

scuffeditalian avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.