1.0.1 • Published 9 months ago
@codecommander/ch v1.0.1
Welecom to @codecommander/ch
What to add
Main bot file
Here is what you need to add into your main bot file
const CH = require("@codecommander/ch"); // add at the top of the file
client.on("ready", async () => { // - bot ready function
console.log("The bot is ready!");
mongoose.set("strictQuery", false);
mongoose.connect(process.env.MONGO_URI, {
keepAlive: true,
}); // mongoose connect
new CH({
client, // the client that is already defiened
mongoUri: process.env.MONGO_URI, // uses the same db as your normal bot (you can use a seperat mongo db just name it in the .env file as a different name and use the same name here)
commandsDir: path.join(__dirname, "commands"), // commands folder
featuresDir: path.join(__dirname, "features"), // features folder
events: {
dir: path.join(__dirname, "events"), // events folder
},
testServers: ["0123456789876543210"], // test server needed if you want some commands to only work in test servers ( you can add more then one as shown here "testServer["0123456789876543210"]")
botOwners: ["0123456789876543210"], // bot owners needed (you can add more then one as shown here "botOwners: ["0123456789876543210", "0123456789876543210"],")
});
});
Command
Here is an example of what the commands will look like with this package
module.exports = {
name: "test", // command name
description: "test command", // command desction
type: "BOTH", // BOTH - slash and legacy, SLASH - Slash, LEGACY - legacy(prefix)
// testOnly: true, // test server only
ownerOnly: false, // owner only
guildOnly: false, // guild only (no dms)
callback: ({ message, interaction }) => {
if (message) {
message.reply("Bot is working - Legacy Commands");
} else {
interaction.reply("Bot is working - Slash Commands");
}
},
};