Skip to content

M6a5x98/discord-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation and starting

Warning

To start the loader, Node.JS and NPM must be installed.

Go in the directory where the program is and type :

npm install

Starting

Go to the .env file and replace the placeholder with your real bot token

Then type :

node .

Plugins

This loader is based on plugins, modules for your bot. They can :

  • Register commands
  • Run scripts when the bot starts
  • Add event listeners

There are to types of plugins, simple and multi :
  • Simples plugins does just one thing
  • Multi plugins do many things

Create a plugin

To create a plugin go in the plugins directory and create a directory named the same as your plugin. Then create a file called plugin.json in the folder and put the following content in it :

{
   "name":"<name_of_your_plugin>",
   "type":"command"|"event"|"script"
   "main":"<your_main_file>"
}

This a file for a simple plugin, to create a multi plugin replace the type and main keys with arrays (["command", "event","event"], ["command.js", "messageCreate.js", "randomEvent.js"])

Command File

If you want to create a command go in the associated file and write :

module.exports = {
  data: {}, //here your /command (you can use raw object or SlashCommandBuilder)
  exec: async (interaction /*the source CommandInteraction*/) => {
    //The code to run when the command is called
  },
};

Event File

If you want to create a event go in the associated file and write :

module.exports = {
  type: "", //here the name of the event
  exec: (/*params of the event*/) => {
    //The code to run when the event is called
  },
};

Script File

If you want to create a startup script go in the associated file and write :

module.exports = (
  client /*the Client running it*/,
  guilds /*the guilds of the bots*/
) => {
  //The code to run when the script is called
};

Limit a plugin to certain servers

As said in config/README.md

If you want to disable some plugins in some servers, you can create a config file named <server_id>.json and then write inside :

{
  "plugins.disabled": ["plugin_to_disable_1", "plugin_to_disable_2", "..."]
}

About

A loader used for Discord bots

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published