how to make a discord.js npm package code example
Example 1: discord.js package
const Discord = require ('discord.js')
const bot = new Discord.Client()
bot.on("ready", async () => {
console.log("the bot is ready")
})
client.on('message', msg => {
if (msg.content === '!ping')
msg.reply(
"pong!"
)
});
bot.login('TOKEN')
Example 2: discord.js download
const Discord = require('discord.js');
const client - new Discord.Client();
const prefix = "?"
client.on("ready", () => {
console.log('literally anything you want goes here')
})
client.on('message', message => {
if(message.content.startsWith(`${prefix}ping`)){
message.channel.send('pong!');
}
})
client.login('your token here');