mirror of
https://github.com/runcitadel/core.git
synced 2024-12-28 15:42:59 +00:00
9054194ab7
Co-authored-by: nolim1t - f6287b82CC84bcbd <nolim1t@users.noreply.github.com> Co-authored-by: Aaron Dewes <aaron.dewes@protonmail.com> Co-authored-by: Philipp Walter <philippwalter@pm.me> Co-authored-by: Lele <emanuele.lele.calo@gmail.com>
32 lines
784 B
Python
Executable File
32 lines
784 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# SPDX-FileCopyrightText: 2022 Citadel and contributors
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import socket
|
|
import os
|
|
|
|
rootDir = os.path.dirname(os.path.abspath(__file__))
|
|
os.chdir(rootDir)
|
|
|
|
if os.path.exists("events/karen"):
|
|
os.remove("events/karen")
|
|
|
|
server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
server.bind("events/karen")
|
|
|
|
while True:
|
|
server.listen(1)
|
|
conn, addr = server.accept()
|
|
datagram = conn.recv(1024)
|
|
if datagram:
|
|
instructions = datagram.decode("utf-8").strip().split()
|
|
cmd = instructions[0]
|
|
if(cmd == "trigger"):
|
|
trigger = instructions[1]
|
|
instructions.pop(0)
|
|
instructions.pop(0)
|
|
os.system("events/triggers/{} {}".format(trigger, " ".join(instructions)))
|
|
conn.close()
|