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

@jmerle/rg-bot

v1.2.1-k

Published

A library allowing users to easily design and control Regression Games bots in a variety of games

Downloads

1

Readme

Regression Games Bot

View API Documentation

A stable and user-friendly JavaScript library for creating Bots in a variety of games.

This library was originally created by Regression Games for use in conjunction with our AI platform, but can easily be integrated into your own projects.

Regression Games is currently in its alpha stage and supports Minecraft. Support for other games will be added over time.

Install

npm install rg-bot

Minecraft

Regression Games uses the Mineflayer API to interact with Minecraft's API, and the Mineflayer-Pathfinder plugin to handle complex movements.

RGBot offers a range of methods for interacting with the Minecraft world including placing and breaking Blocks, looting from and depositing into chests, and initiating combat.

Usage within Regression Games

The Regression Games platform requires an index.js file with an exported configureBot method which acts as an entrypoint into your bot script. When a match is started through the Regression Games platform, an RGBot is created and configured for the player and passed to the configureBot method.

Example:

/**
 * @param {RGBot} bot
 */
function configureBot(bot) {

    // turn on debug logging 
    // logs are displayed within the Regression Games app during a match
    bot.setDebug(true);

    // announce in chat when Bot spawns
    bot.on('spawn', function() {
        bot.chat('Hello World');
    })

    // use in-game chat to make the Bot collect or drop wood for you
    bot.on('chat', async function (username, message) {
        if(username === bot.mineflayer().username) return

        if(message === 'collect wood') {
            await bot.findAndDigBlock('log', {partialMatch: true});
        }
        else if (message === 'drop wood') {
            await bot.dropInventoryItem('log', {partialMatch: true, quantity: 1});
        }
    })

}

exports.configureBot = configureBot;

External use

While rg-bot is primarily developed to support the Regression Games platform, it can also be integrated into non-Regression-Games projects. Usage in unaffiliated projects is nearly identical to Usage within Regression Games with the distinction that you must instantiate and configure your own mineflayer Bot and RGBot.

Example:

// import mineflayer and rg-bot
const mineflayer = require('mineflayer');
const RGBot = require('rg-bot').RGBot;

// create mineflayer bot
const bot = mineflayer.createBot({username: 'Bot'});

// create an RGBot
// RGBot interacts directly with your mineflayer Bot instance
const rg = new RGBot(bot);
rg.setDebug(true);

// you can invoke methods from both the mineflayer Bot and RGBot
bot.on('spawn', function() {
    rg.chat('Hello World');
})

// or you can can choose to make calls to mineflayer through the RGBot for consistency
rg.mineflayer().on('chat', async function (username, message) {
    if(username === rg.mineflayer().username) return
    
    if(message === 'collect wood') {
        await rg.findAndDigBlock('log', {partialMatch: true});
    }
    else if (message === 'drop wood') {
        await rg.dropInventoryItem('log', {partialMatch: true, quantity: 1});
    }
})

Additional Examples

For more examples to help you get started with the rg-bot package, see these templates from Regression Games:

Join us on Discord!

Have a question or want to discuss improvements and new ideas? Contact us through the Regression Games Discord Server.