Giter Site home page Giter Site logo

harrisonhoward / eris.js-commando Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 105 KB

A custom Eris command handler designed for Forbidden Statistics

License: MIT License

JavaScript 100.00%
eris command-handler javascript typesript discord discord-bot discord-api

eris.js-commando's Introduction

Read Github README, in case of unpublished changes

Eris.js-Commando

not a clone of discord.js-commando
A custom Eris command handler designed for Forbidden Statistics

npm install eris.js-commando

Install forbidden-node-logger for a colour node console logger

npm install forbidden-node-logger

NPM Version NPM Downloads

Features

Commands, Groups and Parent Groups

Give your bot project structure with Parent Groups and Groups. With these structures you can make having hundreds of commands a breeze to navigate through.
Example:

    - Basic
        * ping.js
        * help.js
        * invite.js
    - Config
        - Join and Leave
            * join.js
            * leave.js
        - Logging
            * mod-log.js
            * action-log.js

Database Providers

In-built SQLiteProvider and MongoDBProvider to allow you quickly and efficiently start using a database without the hassle of having to build functions yourself.
MongoDB

const MongoDBProvider = Commando.MongoDBProvider;
const { MongoClient } = require("mongodb");
bot.setProvider(
    new MongoDBProvider({ host: settings.host, name: settings.name, auth: settings.auth }),
    MongoClient
);

SQLite

const SQLite = require("sqlite");
const SQLiteProvider = Commando.SQLiteProvider;
const Path = require("path");
bot.setProvider(
    SQLite.open(Path.join(__dirname + "settings.sqlite")).then(db => new sqlite(db))
);

Custom Logging with File Support

Support for forbidden-node-logger allows you to save logs file and keep your previous 1000 logs in cache without having to manually open your bot terminal.
npm install forbidden-node-logger

bot.Logger.log("Super cool log command!");
bot.Logger.history.first();
bot.Logger.fileHistory.getLatestLog();

Utility Manager

In-built utility manager allows you to use useful functions. The default functions include getting a users tag (username + discriminator) and others allows you to add, get different settings from storage using a map over having to manage your database yourself.
Along with these features you can add your own utils onto the manager itself.
to keep typings you would have to modify the typings file, I'm looking into better options

bot.util.useful.getUserTag(message.author);
function loadUtils(bot) {
    if (!bot.util.checkProps("myfunctions")) {
        bot.util.myfunctions = myfunctions;
    }
    bot.util.bindAll();
}

Webhook Manager

In-built webhook manager allows you to quickly have your bot listen on a port and wait on a sub-directory url (i.e. "/request").
This is useful for bots waiting for votes from popular listing sites like Bots for Discord and Discord Bot List.

bot.webhookmngr.listenOn(5000);
bot.webhookmngr.waitFor(5000, "/bfdwebhook", (bot data) => {}, "MyBFDAuth");
bot.webhookmngr.waitFor(5000, "/dblwebhook", (bot, data) => {}, "MyDBLAuth");

Getting Started

Basic Bot

const Commando = require("eris.js-commando");
const bot = Commando.CommandClient(token, {}, {
    name: "CoolErisBot",
    description: "My super cool bot that can do everything!",
    prefix: "!"
}, { dirPath: __dirname + "/logs" }); 
// replace { dirPath: __dirname + "/logs" } with false if you don't have "forbidden-node-logger"
// Along with that remove all bot.Logger references

bot.Logger.on("error", () => {});
bot.on("ready", () => {
    bot.Logger.log("none", `Client ready! Logged in as &-6${bot.user.username}&r (&-c${bot.user.id}&r)`);
});

bot.registerGroup("Basic", "basic");
bot.registerCommandsIn(__dirname + "/commands");

bot.connect();

Test Scripts

In the project directory you can run the following scripts (Make sure you have the environment setup correctly):

npm run base

Will run the Base Test of the handler
Located at test/BaseTest/bot.js

npm run full

Will run the Full Test of the handler
Located at test/FullTest/bot.js

eris.js-commando's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

notshxde

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.