Fix bugs + clean code
parent
b3ab94ef78
commit
6a606a61f5
|
@ -7,10 +7,6 @@ WORKDIR /usr/src/app
|
||||||
COPY requirements.txt ./
|
COPY requirements.txt ./
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# # Prepare MC server
|
|
||||||
# COPY server.jar ./
|
|
||||||
# RUN java -jar server.jar --nogui
|
|
||||||
|
|
||||||
COPY src/ ./src/
|
COPY src/ ./src/
|
||||||
COPY main.py ./
|
COPY main.py ./
|
||||||
|
|
||||||
|
|
|
@ -38,4 +38,6 @@ services:
|
||||||
- <your whitelist>:/usr/src/app/whitelist.json
|
- <your whitelist>:/usr/src/app/whitelist.json
|
||||||
- <your world folder>:/usr/src/app/world
|
- <your world folder>:/usr/src/app/world
|
||||||
- <your server jar file>:/usr/src/app/server.jar
|
- <your server jar file>:/usr/src/app/server.jar
|
||||||
|
ports:
|
||||||
|
- 25565:25565
|
||||||
```
|
```
|
|
@ -39,11 +39,11 @@ matrix:
|
||||||
# When multiple RegEx strings apply, all are included.
|
# When multiple RegEx strings apply, all are included.
|
||||||
alternative_platforms:
|
alternative_platforms:
|
||||||
Discord:
|
Discord:
|
||||||
match: "@_?discord_\d+:.+"
|
match: "@_?discord_\\d+:.+"
|
||||||
text: D
|
text: D
|
||||||
color: aqua
|
color: aqua
|
||||||
WhatsApp:
|
WhatsApp:
|
||||||
match: "@whatsapp_\d+:.+"
|
match: "@whatsapp_\\d+:.+"
|
||||||
text: W
|
text: W
|
||||||
color: green
|
color: green
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from typing import Any, List, Optional
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
with open('config.yaml', 'r') as open_file:
|
with open('config.yaml', 'r') as open_file:
|
||||||
SETTINGS = yaml.load(open_file)
|
SETTINGS = yaml.load(open_file, Loader=yaml.Loader)
|
||||||
|
|
||||||
def at(keys : List[str]) -> Optional[Any]:
|
def at(keys : List[str]) -> Optional[Any]:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -28,6 +28,7 @@ async def start(client, mc_channel):
|
||||||
"""
|
"""
|
||||||
Start reading from the Minecraft subprocess.
|
Start reading from the Minecraft subprocess.
|
||||||
"""
|
"""
|
||||||
|
# Provide 3 seconds to prepare the server
|
||||||
await asyncio.sleep(3)
|
await asyncio.sleep(3)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
@ -81,7 +82,7 @@ def process_message(sentence : str) -> Union[str, None]:
|
||||||
r"\[[\d:]+\] \[Server thread\/INFO\]: Done \(\d+.?\d*s\)! For help, type \"help\"",
|
r"\[[\d:]+\] \[Server thread\/INFO\]: Done \(\d+.?\d*s\)! For help, type \"help\"",
|
||||||
sentence):
|
sentence):
|
||||||
server_live = True
|
server_live = True
|
||||||
return f"The Minecraft server is live. The server is reacable at <code>{config.SERVER_IP}</code>.", f"The minecraft server is live. The server is reacable at <code>{config.SERVER_IP}</code>."
|
return f"The Minecraft server is live. The server is reachable at <code>{config.SERVER_IP}</code>.", f"The minecraft server is live. The server is reachable at <code>{config.SERVER_IP}</code>."
|
||||||
|
|
||||||
if re.fullmatch(
|
if re.fullmatch(
|
||||||
r"\[[\d:]+\] \[Server thread\/INFO\]: Stopping server",
|
r"\[[\d:]+\] \[Server thread\/INFO\]: Stopping server",
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
Loading…
Reference in New Issue