Skip to content

A package to help fetch and create functions with aoi.js

License

Notifications You must be signed in to change notification settings

aoijs/aoi.plugins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@akarui/aoi.plugins

aoiinvite aoiinvite

Installation

You can install the package using npm:

npm install @akarui/aoi.plugins

Setup

const {AoiClient} = require("aoi.js");
const {PluginManager} = require("@akarui/aoi.plugins");

const bot = new AoiClient({
    token: "DISCORD BOT TOKEN",
    prefix: "DISCORD BOT PREFIX",
    intents: ["MessageContent", "Guilds", "GuildMessages"],
    events: ["onMessage"],
    database: {
        type: "aoi.db",
        db: require("@akarui/aoi.db"),
        tables: ["main"],
        path: "./database/",
        extraOptions: {
            dbType: "KeyValue"
        }
    }
});

// Ping Command
bot.command({
    name: "ping",
    code: `Pong! $pingms`
});

const pluginManager = new PluginManager(bot);

pluginManager.loadPlugins("default/comment"); //Loads the from the default folder ($comment function)

Plugins

The Plugins class provides a way to load and manage plugins for your Discord bot.

To load plugins:

pluginManager.loadPlugins(
    "default/os",
    "default/comment",
)

or

pluginManager.load(); // if plugins are added via command line interface

Create your own plugins

To create your own plugins you can use the command line interface.

npx aoilib create username/pluginname

This will generate a boilerplate project for your plugin.

After adding your code to the plugin you can prepare it for library by using the command line interface.

npx aoilib bundle username/pluginname

This will generate a bundle file for your plugin which can be used in the library.

Add plugins to the library

To add your plugins to the library, you can add via Pull Request on the GitHub Repository.

Add plugins via command line interface

You can also add plugins via the command line interface.

npx aoilib add default/os default/comment

This will add the plugins to aoijs.plugins file

As well the setup must change if you this method.

const pluginManager = new PluginManager(bot);

- pluginManager.loadPlugins(
-     "default/os",
-     "default/comment",
- ); // Load all Plugins Functions from @akarui/aoi.plugins 

+ pluginManager.load();