gochatapi
v1.5.4
Published
This is a Node.js Wrapper for zekros goChat github.com/zekroTJA/goChat
Downloads
2
Readme
This is a Bot API/Wrapper for ZekrosTJA goChat
Required Packages:
- ws
Installaton
$ npm i --save gochatapi
Events
Eventname | What it parses | Description |----|----|----| | Bot_loggedin | -/- | Gets called when the Bot logges in | | Bot_registerd | -/- | Gets called when the Bot register his account | | Bot_disconnected | -/- | Gets called when the Bot disconnect | | Bot_error | error | Gets called when the Websocket throws an error | | Client_connected | username, id, color | Gets called when a new User connect to the Chat | | Client_disconnected | name | Gets called when a User disconnect from the Chat | | message | content, id, author { id, username, color }, timestamp | Gets called when a User write a message | | message_Deleted | content, id, author { id, username, color }, timestamp | Gets called when a User delete a message |
Functions
Functionname | What they require | Description |----|----|----| | new Bot | Nickname String, Password String, Url String, Prefix String | starts the Bot session | | send | message String | Sends a message in the Chat | | get_prefix | -/- | Give you the current Prefix | | set_prefix | prefix String | Set the Prefix to the given Parameter | | get_nickname | -/- | Give you the current Nickname | | get_Clients | Clients array | Gives you all CLients in { "Name1": "color", "Name2": "color"} |
How to use Events
Every Event is listed in the example file
How to use Functions
This is an example
const Bot = require('goChatAPI');
var bot1 = new Bot("Bot", "123", "ws://zekro.de:7777/ws", "Prefix");
bot1.Emil.on('Bot_loggedin', () => {
bot1.send("Im cool");
}