lfeclient v1.1.6
LFE Web Bot
Program to automate the new, improved, LFE Web Version:tm:
Docs are at http://docs.tbk321.com/
First Program
First off, I reccommend using TypeScript for typechecking, etc. However, if you are not comfortable using TypeScript for whatever reason (preference, etc) simple JavaScript will work.
npm i -s lfeclient
is the first thing you want to do. This will install the client and all its dependencies. If you are using TS make an index.ts and for plain JS just make an index.js.
TS: import { Client, emotes, directions } from "lfeclient"
JS: const { Client, emotes, directions } = require("lfeclient")
Check the docs for more information on the emotes and directions variables. They are utilities to help you with movement and emoting. Client
is a class. Make a new client using const client = new Client("urlhere", "usernamehere", "passwordhere")
Optionally, you can also supply another argument updateInterval
which is the speed at which we will request chunks & data from the server in milliseconds. 10000 is the default and reccommended value.
The new client
variable has a few diffrent events, but you should mostly be concerned with the "ready" event. client.on("ready")
will be fired when the client is logged it. It is highly reccommended that you put all of the code interacting with the client here unless it is tied to another event like "message" or "debug". Check the docs for all of the events.
Sample program:
"TypeScript";
import { Client, emotes, directions } from "lfeclient";
"JavaScript";
const { Client, emotes, directions } = require("lfeclient");
const client = new Client("http://coollfeserver.com", "botuser101", "supersecurePasswd");
client.on("ready", () => {
client.send("Hello world!");
setInterval(() => {
client.move(directions.northX, directions.northZ);
}, 1000);
});
client.on("debug", console.log);