2.0.1 • Published 8 months ago

raid-lib v2.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

raid-lib

raid-lib is a utility library for enhancing Mineflayer bot interactions, specifically geared towards Minecraft developers. It includes functions to detect and respond to in-game events, such as GUI openings, chat interactions, and attack detections.

Features

  • Detect GUI vs. Chat Responses: Run commands and detect if the response is in chat or a GUI.
  • Entity Attack Detection: Listen for entity attacks with details on attackers, victims, and weapons used.
  • Inventory and Chat Utilities: Find items in a bot’s inventory, transfer items to containers, and filter chat messages with regex patterns.
  • Integrate with ChatGPT: Example functionality to interact with ChatGPT for dynamic in-game responses.

Installation

npm inistall raid-lib

Usage

Importing Raid-lib files const { detectResponseType, findItemInInventory, transferItemToContainer, filterChatMessage, runCommandWithResponse, getAttackData, } = require('raid-lib');

Example Usage

Run an ingame command and detect if the response is GUI-based or chat based. const mineflayer = require('mineflayer');

const bot = mineflayer.createBot({ host: 'localhost', username: 'Bot' });

bot.once('spawn', () => { runCommandWithResponse(bot, '/yourcommand', 'GUI', (isGUI) => { if (isGUI) { console.log("GUI window opened."); } else { console.log("Response was in chat."); } }); });

Track Entity Attacks

Listen to attacks and log information about the attacker, victim, and weapon used getAttackData(bot, (attackData) => { const { victim, attacker, weapon } = attackData; if (weapon) { console.log(${attacker} attacked ${victim} with ${weapon}.); } else { console.log(${attacker} attacked ${victim} with no weapon.); } });

2.0.1

8 months ago

2.0.0

8 months ago

1.0.0

8 months ago