HomeJavaModsMCBotJS | Your scriptable chat bot solution
MCBotJS | Your scriptable chat bot solution
ModsJava

MCBotJS | Your scriptable chat bot solution

⬇ Download on Spigot
MCBotJS

MCBotJS is a one of a kind chat bot creator. Utilize your JavaScript skills to quickly deploy custom bots with loads of features using the MCBotJS API.

The plugin is and will continue to be in active development, so there may lack some features you'd like to see. If you want to recommend a feature for the API, please mention this in the discussion tab.

Commands
/mcbot reload - Reloads all configs and scripts

Configuration
Configure your bots in the configuration like so. The script section is a reference to a js file in the scripts/ directory within the MCBot/ plugin directory.

This is just an example, further configs can be found in the documentation by following the guides.

Code (YAML):
bots:
    Bot1
:
      name
: '&4ExampleBot'
      script
: 'example'
Example Bot
upload_2024-5-12_14-57-41.png


Spoiler: Example Bot Code
With the example config, place the example code into a MCBot/scripts/example.js file
Code (Java):
// Event which handles incoming chat messages
function onMessageSend (bot, message ) {
    // Retrieve the content of the message and the player who sent it
    var content = message. getContent ( ) ;
    var player = message. getPlayer ( ) ;
 
    // Perform different actions based on the content of the message
    switch (content ) {
        case "!hello" :
            // Send a greeting message to the player who sent the command
            bot. sendMessage ( "Hello " + player. getName ( ) ) ;
            break ;
        case "!getRandomWord" :
            // Make an HTTP GET request to fetch a random word from an API
            var response = bot. get ( "https://random-word-api.herokuapp.com/word" ) ;
            // Parse the JSON response
            var responseJSON = JSON. parse (response ) ;
            // Send the random word to the server chat
            bot. sendMessage (responseJSON ) ;
            break ;
    }
}

// Event which handles player join events
function onPlayerJoin (bot, player ) {
    // Construct a welcome message for the server
    var message = "" ;
    if (player. hasPlayedBefore ( ) ) {
        message = "Welcome back " + player. getName ( ) ;
    } else {
        message = "Welcome " + player. getName ( ) ;
    }
    // Send the welcome message to the server
    bot. sendMessage (message ) ;
}

Development Documentation: https://mcbotjs.atlassian.net/wiki/spaces/UM/overview

If you need any help with the api, or if you run into any bugs please ask in the discussion tab, or join the discord server

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

MCBotJS | Your scriptable chat bot solution is a free Minecraft Java mod. Compatible with Minecraft 1.20, 1.20.6. Downloaded 395 times (via Spigot). Download it and open it directly in the game.

Explore more