
Chat2HTTP
A plugin that translates the chat into an http request. Simple as possible!
Оцените первым
481
3
C2HTTP plugin
What is this plugin?
Intercepts player messages and sends them to the specified webhook URL via a POST request (parameters: nick, message, password).
How does it work?
Intercepts player messages and sends them to the specified webhook URL via a POST request (parameters: nick, message, password).
Configuration config.yml
webhook-url: "https://your-server/endpoint"
password: "your_password"
# optional: no-permission-message, config-reloaded, main-text
Commands
/c2h reload- reload the config (requiresc2h.reloadpermission).
Permissions
c2h.reload- access to reload.
Handling example
Uses aiohttp
async def minecraft(request: aiohttp.web.Request):
data = await request.post()
if data.get("password") != config.tokens.chattohttp:
logger.info("Invalid password")
return aiohttp.web.Response(text="Password is not valid", status=401)
nick = data.get("nick")
message = data.get("message")
if not formatter.is_valid_mc_nick(nick):
return aiohttp.web.Response(text="Nick is not valid", status=406)
logger.info(f"{nick} said: {message}")
return aiohttp.web.Response(text="ok")
Building
Install Maven and run
mvn clean package
Versioning
The plugin uses SemVer - <major>.<minor>.<patch>
- major - incompatible changes
- minor - compatible feature changes
- patch - non-functional changes (bugfixes)
Партнёрский материал
Сервер для плагина Chat2HTTP - как у профи
Плагин Chat2HTTP создан для серверов: на своём сервере вы настраиваете его под себя и решаете, кому играть. Создать сервер с плагином Chat2HTTP для друзей можно за пару минут - BungeeHost всё уже подготовил.
