Rewritten and finished framework and bot
This commit is contained in:
parent
f045967591
commit
49a9964ec5
7 changed files with 150 additions and 33 deletions
31
libcommon.py
Normal file
31
libcommon.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
from subprocess import PIPE, STDOUT, Popen, run
|
||||
from typing import Callable, List, Optional, Tuple
|
||||
from re import Pattern
|
||||
|
||||
|
||||
minecraftOutputBinds: List[Tuple[Pattern, Callable]] = []
|
||||
minecraftProc = None
|
||||
|
||||
|
||||
def minecraftInit(cmd: str) -> None:
|
||||
global minecraftProc
|
||||
minecraftProc = Popen(cmd.split(), stdin=PIPE, stdout=PIPE,
|
||||
stderr=STDOUT, text=True, bufsize=1)
|
||||
|
||||
|
||||
class Group:
|
||||
def __init__(self, name: str, id: str):
|
||||
self.name = name
|
||||
self.id = id
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f'<Group "{self.name}" at "{self.id}">'
|
||||
|
||||
|
||||
signalMessageBinds: List[Tuple[Optional[Group], Callable]] = []
|
||||
signalProc = None
|
||||
|
||||
|
||||
def signalInit(cmd: str) -> None:
|
||||
global signalProc
|
||||
signalProc = run(cmd.split(), stdout=PIPE)
|
||||
Loading…
Add table
Add a link
Reference in a new issue