MCBotJS | Your scriptable chat bot solution icon

MCBotJS | Your scriptable chat bot solution -----

MCBotJS is a powerful and easy to use chat-bot creator utilizing JavaScript.



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


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
Resource Information
Author:
----------
Total Downloads: 191
First Release: May 12, 2024
Last Update: May 19, 2024
Category: ---------------
All-Time Rating:
0 ratings
Find more info at mcbotjs.atlassian.net...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings