npm i owot-js
REQUIRES NODE.JS 12.0+!
const OWOTjs = require("owot-js");
var bot = new OWOTjs.Client();
bot.on("join", () => {
bot.chat.send("Hello World!");
});
open
- WebSocket opened
close
- WebSocket closed
chat
- New message in chat [message Object]
tileUpdate
- New tile updates [updates]
fetch
- New fetched tiles [tile]
join
- Joined and got id [id, channel]
origin
- origin (default: https://ourworldoftext.com/
)
ws
- ws url (default: wss://ourworldoftext.com/ws/
)
nickname
- client nickname
world
- world (default: main
)
token
- uvias token
log
- logging enabled or not (default: true
)
Client
- main client class
CharRate
- CharRate class for quota
Tiles
- TileSystem instance
TileSystem
- Class for tiles, char management
nickname
color
id
channel
tileX
tileY
charX
charY
quota
WebSocket connection.
Send writes request.
Buffer for writes.
Size of string chunks when sending writes.
Forced writes flushing.
Set the interval for flushing writes at specified interval in milliseconds.
Sends a chat message.
Request the content of a tile.
Retrieves the character. Returns { char: ' ', color: 0 }
Request content within a specified rectangular region.
Update the cursor position and move the player accordingly.
Write a character.
Get string from x, y to x+len, y.
bool Client.world.writeString(string str = ' ', int color, int startTileX, int startTileY, int startCharX, int startCharY)
Write a string.
Protect tile. You need to be an owner to use this.
object Client.world.createEditItem(string char = ' ', int tileX, int tileY, int charX, int charY, string data = '')
Create edit item.
Leave world.
Users in world.
Chunkify string ensuring the quota.
Convert rgb to int.
Convert char XY to position.
Get current cursor position. Browser only.
Wraps a given input string into a 16x16 grid represented as a 2D array.
Gets the character. Returns: { char: ' ', color: 0 }
Retrieves the tile.
Saves a tile with the given key and content.
Object of every fetched tile.