Docker Detection
This commit is contained in:
parent
46de27aca8
commit
cfd0b84872
@ -7,4 +7,4 @@ RUN pip3 install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
#CMD [ "python3", "main.py"] #Uncomment to start with the Docker Container
|
||||
CMD [ "python3", "main.py"] #Uncomment to start with the Docker Container
|
||||
3
main.py
3
main.py
@ -100,6 +100,8 @@ def thread_main():
|
||||
thread_.start()
|
||||
|
||||
if config.user_module == True:
|
||||
if utility.isRunningInDocker() == False:
|
||||
config.user_module = False
|
||||
thread_ = threading.Thread(target=user_module_init, args=(dbCert, None))
|
||||
threads.append(thread_)
|
||||
thread_.start()
|
||||
@ -109,6 +111,7 @@ def thread_main():
|
||||
t.join()
|
||||
|
||||
print("---Point of no return---")
|
||||
if utility.isRunningInDocker() == False:
|
||||
input()
|
||||
|
||||
|
||||
|
||||
@ -9,6 +9,8 @@ from commands.command_base import AbstractCommand
|
||||
|
||||
from cooldowns import Cooldown_Module
|
||||
|
||||
import utilities_script as utility
|
||||
|
||||
class User_Module():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@ -19,6 +21,9 @@ class User_Module():
|
||||
def main(self):
|
||||
print("\nWaiting on User input...\n")
|
||||
inputLoop = True
|
||||
if utility.isRunningInDocker() == False:
|
||||
inputLoop = False
|
||||
print("\nNo User's Input Allowed")
|
||||
while inputLoop:
|
||||
keyboardInput = input()
|
||||
message = UserMessage()
|
||||
|
||||
@ -65,6 +65,12 @@ def contains_slur(input: str):
|
||||
print("<{ slur detected! }> ")
|
||||
return containsSlur
|
||||
|
||||
def isRunningInDocker():
|
||||
isD = os.getenv('ISDOCKER')
|
||||
if isD is None:
|
||||
return False
|
||||
return isD == "cat"
|
||||
|
||||
def hard_shutdown():
|
||||
current_system_pid = os.getpid()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user