Skip to content

Commit

Permalink
add web api doc
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Sep 7, 2020
1 parent e86dce1 commit 0ce5df8
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Features
# Documentation

* [Manual](./doc/manual.md)
* [Web-API](./doc/web-api.md)

# License

Expand Down
67 changes: 67 additions & 0 deletions doc/web-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Messages sent to/from the mod if the Web-API is configured (with `beerchat.url`)

# Web API Messages

## Ingame to Web

Messages sent via POST to `beerchat.url`

### Channel message

Sent if a player talks on a channel

```json
{
"type": "message",
"channel": "main",
"username": "somedude",
"message": "give me diamonds!"
}
```

*NOTE*: `username` and `channel` can be empty, in this
case the message is a system-message like "Player somedude joined the game"
or "Minetest started"

*NOTE2*: if the channel is `audit` then the `username` will be empty
and the `message` contanins audit-related infos, for example:
* `Player 'somedude' triggered anticheat: 'interact_while_dea' at position: 1,2,3`

### "me" message

Sent if a player uses the /me command

```json
{
"type": "me",
"channel": "main",
"username": "somedude",
"message": "is bored"
}
```

## Web to Ingame

Messages received via GET (and longpoll) to `beerchat.url`

### Normal chat message

```json
{
"username": "SomeDudeXXL",
"message": "hi, i'm on IRC",
"name": "IRC",
"channel": "main"
}
```

### Ingame command

```json
{
"username": "SomeDudeXXL",
"message": "status",
"name": "IRC",
"target_name": "minetest"
}
```

0 comments on commit 0ce5df8

Please sign in to comment.