npm install stops-djs-prefab
const Discord = require('discord.js')
const client = new Discord.Client()
const botPrefab = require('stops-djs-prefab')
new botPrefab(client, {
commandsDir: 'commands' // Commands Directory
eventsDir: 'events'
})
.setToken('super secret token') // logs your bot in (EXPERIMENTAL!)
.setPrefix('>') // sets prefix
.setMongoURI('MONGOURI') // Must have a mongo server up and running!
.showWarnings(false) // If set to false warnings will not show. Set to true by default.
.showLoadedCommands(false) // If set to false it will not log all commands that were successfully loaded. Set to true by default.
.showLoadedEvents(false) // If set to false it will not log all events that were successfully loaded. Set to true by default.
.setOwners(['123456789123456789']) // Sets bot owners for owneronly commands.
Command File in Commands Directory:
module.exports = {
name: 'ping',
aliases: 'p',
execute({ message, args, client }) {
message.reply('Pong!!')
}
}
Event File in Events Directory called (message.js):
module.exports = (client, handler, message) => {
console.log('Successfully cached message!')
message.channel.send('Hello!') // I DO NOT RECOMMEND DOING THIS. IT WILL LEAD TO RATE LIMITS (if there is a very active chat) AND/OR CONFUSION IN ALL PARTIES.
}