discord.js-os v1.0.2
Discord.JS-OS
An intuitive discord.js "Operating System" designed to build bots faster with less trouble.
Installation
npm i discord.js-os
Setup
DJS-OS is a very simple tool used to create an easy to use discord bot, instantly. Setup is simple.
Create your workspace
Inside your root directory...
mkdir commands
mkdir events
Then, create your entry file in your root folder. (e.g index.js)
Initiating DJS-OS
In your entry file...
const DJS = require("discord.js-os")
const djs = new DJS({
token: "your_bot_token",
rootDir: __dirname,
handleCommands: true,
prefix: "!"
})
const client = djs.client;
You have now successfully setup DJS-OS and it will login to discord.
Adding Events
You can add any discord.js event into your events folder, using the event name as the file name (e.g ready.js
)
You can format your files like so...
exports = async (client) => { // all props included in the event will be run through this function
// code to run for this event
};
Adding Commands
You can add any command into your commands folder, using the command name as the file name (e.g ping.js
)
You can format your files like so...
exports.run = async (client, message, args) => { // The args prop is an array consisting of the message content, split by spaces. (Not including the prefix and command name)
}
Using MongoDB
DJS-OS also allows built in mongodb integration. Using mongoose.
You can setup mongoose automatically by adding the mongodb property in your configuration. (This should be a mongodb connection string)
DJS-OS will then automatically sort your mongoose schemas into an object of models, mapped by their names. client.mongo
Adding mongoose schemas
In your root directory...
mkdir mongoose
You can add any mongoose schema into your mongoose folder, using the desired model name as the file name (e.g guildConf.js
)
You can format your files like so...
const mongoose = require("mongoose");
const schema = new mongoose.Schema({
// props here
})
exports = mongoose.model('your_model_name', schema);
Support
If you need any help or have any questions about this package please reach out to us in the support server