From 3cb0e8dc5fa436b50f83b978a0bb1e189f90a1f3 Mon Sep 17 00:00:00 2001 From: neelkamath Date: Fri, 11 May 2018 21:30:27 +0530 Subject: Document --- DOCUMENTATION.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 DOCUMENTATION.md (limited to 'DOCUMENTATION.md') diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md new file mode 100644 index 0000000..0810db7 --- /dev/null +++ b/DOCUMENTATION.md @@ -0,0 +1,36 @@ +You can programmatically access hack.chat using the following commands. + +hack.chat has three permission levels. When you access a command, hack.chat automatically knows your permission level from your trip code. The lowest permission level is `core`. `mod` is above `core`, so it can access `core` commands in addition to `mod` commands. `admin` is similarly above `mod`. + +# `core` + +|Command|Parameters|Explanation| +|-------|----------|-----------| +|`changenick`|`nick`|This will change your current connections nickname| +|`chat`|`text`|Broadcasts passed `text` field to the calling users channel| +|`disconnect`||Event handler or force disconnect (if your into that kind of thing)| +|`help`|`type` or `category`, `command`|Outputs information about the servers current protocol| +|`invite`|`nick`|Generates a unique (more or less) room name and passes it to two clients| +|`join`|`channel`, `nick`|Place calling socket into target channel with target nick & broadcast event to channel| +|`morestats`||Sends back current server stats to the calling client| +|`move`|`channel`|This will change the current channel to the new one provided| +|`showcases`|`echo`|Simple command module template & info| +|`stats`||Sends back legacy server stats to the calling client| + +# `mod` + +|Command|Parameters|Explanation| +|-------|----------|-----------| +|`ban`|`nick`|Disconnects the target nickname in the same channel as calling socket & adds to ratelimiter| +|`kick`|`nick`|Silently forces target client(s) into another channel. `nick` may be string or array of strings| +|`unban`|`ip` or `hash`|Removes target ip from the ratelimiter| + +# `admin` + +|Command|Parameters|Explanation| +|-------|----------|-----------| +|`addmod`|`nick`|Adds target trip to the config as a mod and upgrades the socket type| +|`listusers`||Outputs all current channels and sockets in those channels| +|`reload`||(Re)loads any new commands into memory, outputs errors if any| +|`saveconfig`||Saves current config| +|`shout`|`text`|Displays passed text to every client connected| \ No newline at end of file -- cgit v1.2.1 From 880b0f7c2781adab03906be525e12ef7f9956d05 Mon Sep 17 00:00:00 2001 From: neelkamath Date: Sat, 12 May 2018 13:49:55 +0530 Subject: Clarify documentation --- DOCUMENTATION.md | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'DOCUMENTATION.md') diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 0810db7..97d46b8 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -2,35 +2,37 @@ You can programmatically access hack.chat using the following commands. hack.chat has three permission levels. When you access a command, hack.chat automatically knows your permission level from your trip code. The lowest permission level is `core`. `mod` is above `core`, so it can access `core` commands in addition to `mod` commands. `admin` is similarly above `mod`. +The commands are to be sent through a websocket to the URL wss://hack.chat/chat-ws (everything sent and received are `string`s). If you are sending messages locally or to another domain, replace 'hack.chat' with that domain. If you're running your own instance of hack.chat, you can retain backwards-compatibility in order to ensure that software created for the main server will work on yours too. + # `core` |Command|Parameters|Explanation| |-------|----------|-----------| -|`changenick`|`nick`|This will change your current connections nickname| -|`chat`|`text`|Broadcasts passed `text` field to the calling users channel| -|`disconnect`||Event handler or force disconnect (if your into that kind of thing)| -|`help`|`type` or `category`, `command`|Outputs information about the servers current protocol| -|`invite`|`nick`|Generates a unique (more or less) room name and passes it to two clients| -|`join`|`channel`, `nick`|Place calling socket into target channel with target nick & broadcast event to channel| -|`morestats`||Sends back current server stats to the calling client| -|`move`|`channel`|This will change the current channel to the new one provided| +|`changenick`|`nick`|Changes the current connection's nickname.| +|`chat`|`text`|This broadcasts `text` to the channel the user is connected to.| +|`disconnect`||An event handler or forced disconnect.| +|`help`|`category` or `command`|Gives documentation programmatically. If `category` (the permission level, such as `mod`) is sent, a list of commands available to that permission level will be sent back (as a `string` and not an `array`). This list only includes what is unique to that category and not every command a user with that permission level could perform. If `command` (e.g., `chat`), a description of the command will be sent back.| +|`invite`|`nick`|Generates a pseudo-unique channel name and passes it to both the calling user and `nick`.| +|`join`|`channel`, `nick`|Places the calling socket into the target channel with the target nick and broadcasts the event to the channel.| +|`morestats`||Sends back the current server's stats to the calling client.| +|`move`|`channel`|This will change the current channel to `channel`.| |`showcases`|`echo`|Simple command module template & info| -|`stats`||Sends back legacy server stats to the calling client| +|`stats`||Sends back legacy server stats to the calling client. Use `morestats` when possible.| # `mod` |Command|Parameters|Explanation| |-------|----------|-----------| -|`ban`|`nick`|Disconnects the target nickname in the same channel as calling socket & adds to ratelimiter| -|`kick`|`nick`|Silently forces target client(s) into another channel. `nick` may be string or array of strings| -|`unban`|`ip` or `hash`|Removes target ip from the ratelimiter| +|`ban`|`nick`|Disconnects the target nickname in the same channel as the calling socket and adds it to the rate limiter.| +|`kick`|`nick`|Silently forces target client(s) into another channel. `nick` may be `string` or `array` of `string`s.| +|`unban`|`ip` or `hash`|Removes the target ip from the rate limiter.| # `admin` |Command|Parameters|Explanation| |-------|----------|-----------| -|`addmod`|`nick`|Adds target trip to the config as a mod and upgrades the socket type| -|`listusers`||Outputs all current channels and sockets in those channels| -|`reload`||(Re)loads any new commands into memory, outputs errors if any| -|`saveconfig`||Saves current config| -|`shout`|`text`|Displays passed text to every client connected| \ No newline at end of file +|`addmod`|`nick`|Adds the target trip to the config as a mod and upgrades the socket type.| +|`listusers`||Outputs all current channels and sockets in those channels.| +|`reload`||(Re)loads any new commands into memory and outputs errors, if any.| +|`saveconfig`||Saves the current config.| +|`shout`|`text`|Displays the passed text to each client connected.| \ No newline at end of file -- cgit v1.2.1 From 4b30736929e65ec7ad664b2ffb2d1eca10b0636a Mon Sep 17 00:00:00 2001 From: neelkamath Date: Sat, 12 May 2018 13:52:19 +0530 Subject: Remove help.js as we need human, not programmatic documentation for this --- DOCUMENTATION.md | 1 - 1 file changed, 1 deletion(-) (limited to 'DOCUMENTATION.md') diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 97d46b8..eaf3303 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -11,7 +11,6 @@ The commands are to be sent through a websocket to the URL wss://hack.chat/chat- |`changenick`|`nick`|Changes the current connection's nickname.| |`chat`|`text`|This broadcasts `text` to the channel the user is connected to.| |`disconnect`||An event handler or forced disconnect.| -|`help`|`category` or `command`|Gives documentation programmatically. If `category` (the permission level, such as `mod`) is sent, a list of commands available to that permission level will be sent back (as a `string` and not an `array`). This list only includes what is unique to that category and not every command a user with that permission level could perform. If `command` (e.g., `chat`), a description of the command will be sent back.| |`invite`|`nick`|Generates a pseudo-unique channel name and passes it to both the calling user and `nick`.| |`join`|`channel`, `nick`|Places the calling socket into the target channel with the target nick and broadcasts the event to the channel.| |`morestats`||Sends back the current server's stats to the calling client.| -- cgit v1.2.1 From acbad15f2bc4a6733407bc17e1a5b4190ed3b287 Mon Sep 17 00:00:00 2001 From: neelkamath Date: Sat, 12 May 2018 14:13:12 +0530 Subject: Remove unused object fields --- DOCUMENTATION.md | 1 - 1 file changed, 1 deletion(-) (limited to 'DOCUMENTATION.md') diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index eaf3303..c110188 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -15,7 +15,6 @@ The commands are to be sent through a websocket to the URL wss://hack.chat/chat- |`join`|`channel`, `nick`|Places the calling socket into the target channel with the target nick and broadcasts the event to the channel.| |`morestats`||Sends back the current server's stats to the calling client.| |`move`|`channel`|This will change the current channel to `channel`.| -|`showcases`|`echo`|Simple command module template & info| |`stats`||Sends back legacy server stats to the calling client. Use `morestats` when possible.| # `mod` -- cgit v1.2.1 From 343157350f627b9495184246a90033a1c41f1a2c Mon Sep 17 00:00:00 2001 From: Neel Kamath Date: Sun, 13 May 2018 16:03:22 +0530 Subject: Re-add module documentation --- DOCUMENTATION.md | 1 + 1 file changed, 1 insertion(+) (limited to 'DOCUMENTATION.md') diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index c110188..1b797f3 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -16,6 +16,7 @@ The commands are to be sent through a websocket to the URL wss://hack.chat/chat- |`morestats`||Sends back the current server's stats to the calling client.| |`move`|`channel`|This will change the current channel to `channel`.| |`stats`||Sends back legacy server stats to the calling client. Use `morestats` when possible.| +|`help`|`category` or `command`|Gives documentation programmatically. If `category` (the permission level, such as `mod`) is sent, a list of commands available to that permission level will be sent back (as a `string` and not an `array`). This list only includes what is unique to that category and not every command a user with that permission level could perform. If `command` (e.g., `chat`) is sent, a description of the command will be sent back.| # `mod` -- cgit v1.2.1 From b42c93a7a712beea4fefca9785cf776e93c85e65 Mon Sep 17 00:00:00 2001 From: Neel Kamath Date: Mon, 14 May 2018 14:19:29 +0530 Subject: Add initial connection documentation --- DOCUMENTATION.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'DOCUMENTATION.md') diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 1b797f3..4fa9055 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -1,8 +1,17 @@ -You can programmatically access hack.chat using the following commands. +You can programmatically access hack.chat using the following commands via a websocket. To prevent getting disconnected, ping the server every 50 seconds. A list of wrappers written for accessing hack.chat can be found [here](https://github.com/hack-chat/3rd-party-software-list#libraries). -hack.chat has three permission levels. When you access a command, hack.chat automatically knows your permission level from your trip code. The lowest permission level is `core`. `mod` is above `core`, so it can access `core` commands in addition to `mod` commands. `admin` is similarly above `mod`. +The commands are to be sent through a websocket to the URL `wss://hack.chat/chat-ws` (everything sent and received are `string`s). If you are sending messages locally or to another domain, replace 'hack.chat' with the respective domain. If you're running your own instance of hack.chat, you can retain backwards-compatibility in order to ensure that software created for the main server will work on yours too. + +All commands sent must be JSON objects with the command specified in the `"cmd"` key. For example: +```json +{ + "cmd": "join", + "channel": "programming", + "nick": "johndoe#fag" +} +``` -The commands are to be sent through a websocket to the URL wss://hack.chat/chat-ws (everything sent and received are `string`s). If you are sending messages locally or to another domain, replace 'hack.chat' with that domain. If you're running your own instance of hack.chat, you can retain backwards-compatibility in order to ensure that software created for the main server will work on yours too. +hack.chat has three permission levels. When you access a command, hack.chat automatically knows your permission level from your trip code. The lowest permission level is `core`. `mod` is above `core`, so it can access `core` commands in addition to `mod` commands. `admin` is similarly above `mod`. # `core` -- cgit v1.2.1