Serve/modules/minecraft_signal_bridge.py

41 lines
No EOL
1.3 KiB
Python

import libminecraft
import libsignal
import libcommon
RetardsServer = libcommon.Group(
"Retards Server", "5PlbXaPmWZQkhmuyyC/fkWTy8K+BqomjK7byVDyxmpo=")
players = {
"Malasaur": "Malasaur",
"AlForno": "stef",
"Filippo": "BrixsBang",
"Mr Beast": "firr",
"Nick": "NPZ",
"Osvaldo": "Cheruz",
"Black Gigef": "Gigef",
}
@libminecraft.onConsoleOutput(r"\[.*\] \[Server thread\/INFO\]: <(.*)> (.*)")
def minecraftToSignal(usr: str, msg: str):
libsignal.sendMessage(f"<{usr}> {msg}", RetardsServer)
@libsignal.onMessage(RetardsServer)
def signalToMinecraft(usr: str, msg: str):
usr = players.get(usr, usr)
libminecraft.sendCommand(f'tellraw @a "<{usr}> {msg}"')
@libminecraft.onConsoleOutput(r"\[.*\] \[Server thread\/INFO\]: (.*) joined the game")
def minecraftPlayerJoin(usr: str):
libsignal.sendMessage(f"{usr} joined the game.", RetardsServer)
@libminecraft.onConsoleOutput(r"\[.*\] \[Server thread\/INFO\]: (.*) left the game")
def minecraftPlayerLeave(usr: str):
libsignal.sendMessage(f"{usr} left the game.", RetardsServer)
@libminecraft.onConsoleOutput(r"\[.*\] \[Server thread\/INFO\]: (.*) fell from a high place")
def minecraftFallDeath(usr: str):
libminecraft.sendCommand(f"say {usr} sei un coglione come cazzo fai a morire di danno da caduta lmfao")