1.3.0 • Published 7 months ago

easydiscommands v1.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

easydiscommands

allows you to make discord.js commands very easily!

example for a global ping pong command:

index.js:

const {Client, REST} = require("discord.js")
const client = new Client({intents: 131071})
const token = 'TOKEN'
const clientid = 'CLIENT_ID';
const rest = new REST().setToken(token);
const {Globalcommand} = require('easydiscommands')
client.on('ready',() => {
  console.log(`active as ${client.user.tag}`)

})
Globalcommand(rest,client,clientid) //send global command rest client and clientId
client.login(token)

CREATE A folder named 'commands' in the root of the project and inside of commands make a folder(the name of the folders inside of commands dont matter they are just catagories for orginazison you can add as many as you like.) inside of the new folder create pong.js:

const { SlashCommandBuilder,EmbedBuilder } = require('discord.js');
module.exports = {
	data: new SlashCommandBuilder()
 // the slash command builder has many diffrent methods you can use: https://old.discordjs.dev/#/docs/discord.js/main/class/ApplicationCommand
		.setName('ping')
		.setDescription('Check server Status'),
	async execute(interaction) {interaction.reply("pong")}}

and thats it! you can add more catagories and commands without any problems!

bot setup:

go to https://discord.com/developers/ login and press new application name your app and press create then press 'bot' and turn on all intents on this page you can also get the token (BE CARFUL WITH IT) then you can go to 'Oauth2' and copy the bot id. then you can add the botid and token to the code and start making bots!

tips

in the project root create a folder named botconfig and inside of the folder create config.json config.json:

{
    "token": "TOKEN",
    "botId": "BOTID"
}

then in your code instead of just putting your token use:

const {token, botId} = require('./botconfig/config.json')
1.3.0

7 months ago

1.2.0

7 months ago