vas-chat-reactor
v1.1.3
Published
A mineflayer plugin that reacts to word descramble chat messages.
Downloads
5
Maintainers
Readme
vas-chat-reactor
A plugin for mineflayer which allows the bot to respond to Chat Reaction messages
Prerequisites
Installation
Clone this repository in node_modules
folder and run:
npm install
Or just simply:
npm install vas-chat-reactor
Configuration
- Move or copy the file
chat_config.ini
in the bot directory. Make sure to have it in the same directory wherenodejs
starts. - Fill in the
chat_config.ini
file with the necessary things to identify Chat Reaction messages and extract the word from it. You will find all the documentation inside it. ThedictionaryFile
andunknownWordsFile
paths are relative to wherenodejs
starts. - Fill the time to wait until the bot writes the word
(will be evaluated with
eval(timeout)
). I found that1850 + ~~((0.5 + Math.random()/2) * 150 * word.length)
works best looking at how quick other players write. - Fill in the chance to write the word. 0 or less means 0% or never write the word and 1 or bigger is 100% chance of writing.
- Write all the known possible words to descramble in
dictionaryFile
, one on every line. If you don't know the words, let the bot run for some time until it will collect most of them.
Anytime the bot will find an unknown word it will write it into the
unknownWordsFile
, as specificated in configuration file.
Don't use my config and dictionary file, they are just a reference guide!
Why don't I use regex instead of string.startsWith
, string.endsWith
and substring
? Because it's faster this way and you can't have weird
patterns in the message. Maybe I'm wrong...
Usage
Simply require it and add it to bot's plugins.
const mineflayer = require("mineflayer");
const chatReactor = require("vas-chat-reactor");
const bot = mineflayer.createBot({
"host": "HOST",
"port": 25565,
"username": "USERNAME",
"password": "PASSWORD",
"plugins": [chatReactor],
});
Or, if you prefer:
// Bot is already created here
require("vas-chat-reactor")(bot);
And then:
bot.enableChatReaction();
And if you want to disable it on the fly:
bot.disableChatReaction();
Additionally, if you want to see debug information, you can set the
_DEBUG
variable on row 16 of index.js
to true
.
Test coverage
To test it simply run npm test
.
> npm test
> [email protected] test /home/ubuntu/workspace/git/vas-chat-reactor
> mocha
vas-chat-reactor
Load plugin
✓ should load events
✓ should add functions to the bot
✓ should not crash on message event
3 passing (23ms)
License
This plugin is distributed under Apache 2.0. See LICENSE.
Additional details
Contact
If you have any problems, contact me and I will try to help you. You can find me here.