yl_matterbridge/README.md

150 lines
3.7 KiB
Markdown
Raw Permalink Normal View History

2022-02-25 22:04:07 +00:00
2022-02-25 01:08:59 +00:00
# yl_matterbridge
2022-02-25 22:04:07 +00:00
## Purpose
This mod adds support for [matterbridge](https://github.com/42wim/matterbridge) to handle chat messages between Minetest and other chat protocols like
- Discord
- IRC
- Matrix
- Telegram
- Twitch
- WhatsApp
- and more
2022-02-25 22:04:07 +00:00
## Download
Get it from https://gitea.your-land.de/AliasAlreadyTaken/yl_matterbridge
## Installation
copy the "yl_matterbridge" folder to your mod folder and enable it in your world.mt.
add yl_matterbridge to secure.http_mods in your minetest.conf
2022-02-25 22:33:03 +00:00
```
secure.http_mods = yl_matterbridge
```
2022-02-25 22:04:07 +00:00
Download and install [matterbridge](https://github.com/42wim/matterbridge)
2022-02-25 22:04:07 +00:00
## Configuration
2022-02-25 22:04:07 +00:00
Create a config for [matterbridge](https://github.com/42wim/matterbridge) and the chat protocols you want to use.
2022-02-25 22:04:07 +00:00
* https://github.com/42wim/matterbridge/wiki/How-to-create-your-config
* https://github.com/42wim/matterbridge/wiki/Api
An example config for minetest looks like this
2022-02-25 22:04:07 +00:00
```
[api.mt]
BindAddress="127.0.0.1:4242"
Buffer=1000
RemoteNickFormat="{NICK}"
#Token="mytotallysecrettoken"
2022-02-25 22:04:07 +00:00
```
Gateway section:
```
[[gateway]]
name="default"
enable=true
[[gateway.inout]]
account="api.mt"
channel="api"
```
## Modmakers
2022-02-25 22:04:07 +00:00
API: Overwrite these function in your chat mod, if you want to handle messages yourself
2022-02-25 22:04:07 +00:00
Don't forget to add an optional dependency to yl_matterbridge
Overwrite this function to receive something from the bridge
```
function yl_matterbridge.receive_from_bridge(user_name, message_text)
2022-02-25 22:04:07 +00:00
core.chat_send_all("<" .. user_name .. "@irc> " .. message_text)
end
```
2022-03-02 08:16:48 +00:00
Overwrite this function instead if you want to use other fields coming from the bridge.
```
function yl_matterbridge.receive_all_from_bridge(dataset)
if dataset.username and dataset.text and dataset.account then
local user_name = dataset.username
local message_text = dataset.text
local account_name = dataset.account
yl_matterbridge.receive_from_bridge(user_name, message_text, account_name)
else
core.log(
"error",
"[MOD] yl_matterbridge: receive/http.fetch failed. No dataset in returned data = " .. dump(dataset)
)
end
end
```
Call this function to send something to the bridge
2022-02-25 22:04:07 +00:00
```
function yl_matterbridge.send_to_bridge(user_name, message_text)
send(user_name, message_text)
end
```
Set this function to yl_matterbridge.chat_message = function() end if you call yl_matterbridge.send_to_bridge yourself
```
function yl_matterbridge.chat_message(user_name, message_text)
send_to_bridge(user_name, message_text)
end
```
## Supported versions
If you run yl_matterbridge in one of the supported versions, but something is wrong, please [file a bug](https://gitea.your-land.de/AliasAlreadyTaken/yl_matterbridge/issues/new). PRs also welcome.
If you run yl_matterbridge in one of the unknown versions, like MacOS or Android or Linux, please tell us whether it works or not. We will add your findings to the readme.
There is no reason to believe it doesn't work anywhere, but you never know.
### Windows
MT versions 5.0.0, 5.0.1, 5.1.0, 5.1.1, 5.2.0, 5.3.0, 5.4.0 5.4.1, 5.5.0, 5.6.0, 5.6.1, 5.7.0, 5.8.0
### Linux
MT versions 5.5.0, 5.6.0, 5.6.1, 5.7.0, 5.8.0
### MacOS
unknown
### Android
unknown
### Misc
unknown
## Allied projects
2022-02-25 22:04:07 +00:00
If you know a project that uses this bridge tell us and we will add it to the list.
2022-02-25 22:04:07 +00:00
* smart_chat : https://github.com/acmgit/smart_chat/
* player_events: https://github.com/insanity54/matterbridge_player_events
2022-02-25 22:04:07 +00:00
## Uninstall
Remove it from your mod folder or deactivate it in your world.mt
Mods that depend on it will cease to work, if the mod is removed without proper replacement.
## License
2022-02-26 00:44:31 +00:00
MIT
## Thank you
2022-02-26 02:45:04 +00:00
* Bla
* clyde (https://github.com/acmgit/)