npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yumabot-core

v1.7.6

Published

A lightweight Discord bot framework made in NodeJS using Eris

Downloads

5

Readme

YumaBot-Core NPM Version Dependency Status

YumaBot-Core

A lightweight Discord bot framework made in NodeJS using Eris

Visit the gallery to see some pictures of what this framework does

Installing

Fun Fact: The bot can automatically create the commands and events folder with default files in it so you don't need to copy and paste every thing in the GitHub repository

  1. In the command line execute npm install yumabot-core --save
  2. Create a js file with the following contents: ( see configuration on how to configure these options )
const Yuma = require("yumabot-core");
const bot = new Yuma({
    "token": "TOKEN",
    "prefix": ">",
    "ownerId": "OWNER_ID",
    "dbotsApiKey": "DBOTS_KEY",
    "carbonKey": "CARBON_KEY",
    "cleverbot": true,
    "cleverbotUser": "CLEVERBOT_API_USER",
    "cleverbotKey": "CLEVERBOT_API_KEY",
    "commandSpaces": true
});

bot.connect();

Next, Run the code. The first time you run the code you will recieve a message like shown below:
"Done initializing the command/event folders! Please run the code again to begin"
That means it finished creating the default commands and events, so now you are ready to run the code again and you will be ready to go! :smiley:

You could also replace the object within Yuma with new Yuma(config) where config would be a json file containing those contents.

And that's it! :thumbsup:

Configuration

  • token: Token of your bot. Taken from here
  • prefix: Prefix of your bot. The text that should be followed by a command name to work
  • ownerId: User ID of the user the bot will be treating as the owner
  • dbotsApiKey (optional): Api key from bots.discord.pw
  • carbonKey (optional): Api key from carbonitex
  • cleverbot: Whether the bot should react to @mention or not
  • cleverbotUser: (required for cleverbot) The user key for cleverbot from cleverbot.io
  • cleverbotKey: (required for cleverbot) The api key for cleverbot from cleverbot.io
  • commandSpaces (optional): If true, then it will allow a space between the prefix and command like, would work for both [prefix] [command] and [prefix][command], if set as false, it will not allow a space between command and prefix, would only react to [prefix][command]

Example Command:

Create a new javascript file in ./commands/ and add the following:

// eg: ./commands/kawaii.js
module.exports = {
    ownerOnly: false, // Whether only owner (from ./config.json) can execute this command
    guildOnly: true, // Whether command cannot be executed outside a guild
    cooldown: 2, // Simple cooldown
    aliases: "cute", // An alias of the command. Can also be an array: ["alias1", "alias2"]
    tag: "Basic", // A tag
    description: "Responds with what you said is kawaii", // Short description of the command
    usage: "<name>", // Usage of the command
	perms: { // Object containing required/non-required perms for using the command
		manageMessages: true
	},
    process(bot, msg, suffix) { // Process function of the command
        if(suffix) {
            bot.createMessage(msg.channel.id, suffix + " is kawaii! :3");
        } else bot.createMessage(msg.channel.id, "Please try again with some arguments")
    }
}

Example Event:

Create a new javascript file in ./events/ and add the following:

// eg: ./events/guildCreate.js
module.exports = {
    execute(bot, guild){
        console.log(`New guild: ${guild.name}`);
    }
}

Adding More Tags (help message):

In the help message, you might like your own custom tags, here is how you will do it:

It's very simple! Just go to the file of the command in which you want to add the tag in, and just pop it in like shown below

module.exports = {
    tag: "ExampleTag",
    process(bot, msg, suffix) {
        // code
    }
}

And that's it! The help command will automatically detect all the tags from all the files and generate them into groups of command names to each specific tag. (behold, the power of code..!)


Features:

  • Beautiful logs :tada:
    Image 1

  • Easy to spot errors
    Image 2

  • Commands and Events nested in folders
    this also makes it easier to add/edit commands
    Image 3

  • Configurable Commands and Events
    Image 3

  • Plugins.
    With plugins you can dump all short scripts or functions into a file in the plugins folder to avoid flood of files/code
    Image 4

Other Features

  • In-Built Reload Command
  • In-Built Eval Command
  • Help Message Generator
  • Display Errors without bot crashing

And more..!