-
Notifications
You must be signed in to change notification settings - Fork 1
/
boxEngine.py
182 lines (142 loc) · 5.4 KB
/
boxEngine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import os
import random
import time
import platform
import sys
from configparser import ConfigParser
from rich.console import Console
console = Console()
config = ConfigParser(comment_prefixes="#", delimiters="=")
config.read("data/config/main.ini")
# Color codes:
def warn(stri: str):
console.print(f"[bold][bright_yellow]█ Warning! -> {stri}[/]")
def error(stri: str):
console.print(f"[bold][bright_red]█ Error! -> {stri}[/]")
def success(stri: str):
console.print(f"[bold][bright_green]█ Success! -> {stri}[/]")
try:
configCheck1 = str(config["DEBUG"]["disableRem"])
if configCheck1 == "false":
print("# Reminder!! Every command is CaSe SeNsItIvE")
else: ...
except:
exit("Error! Config file or an element is missing!")
# cmd items not worth putting there
cmdList = ["shellBasic","source","pyclockInit","passgenInit","help","quit","exit","vars","cvar","box"]
ver = str(config["MAIN"]["version"])
console.print(f"[ [bold][bright_green]OK[/] ][italic] boxEngine is loaded![/]")
class boxEngine:
def box(string):
from git import Repo
repo = Repo()
def rok():
return "Exit status:", 0
def rno():
return "Something wrong happened, exit status:",0
def rmdir(path: str):
os.rmdir(path)
def mkdir(name: str):
os.mkdir(name)
def clear():
if os.name() == 'nt':
os.system("cls")
else:
os.system("clear")
def cvar(): # this one wont write.
with open('data/txt/cvar.txt', mode="w+") as file:
print(f"cvar value = {file.read()}")
lines = file.readlines()
cvarI = input("cvar> ")
if cvarI == "exit": ...
elif cvarI == "change":
print("Input new string or integer to change.")
ce = input("cvar>change> ")
with open("data/txt/cvar.txt", "wt") as file:
for line in lines:
file.write(ce)
print(f"New cvar value is:{ce}")
def vars():
config.read("data/config/vars.ini")
try:
readVars = str(config.items("VARS"))
print("Current vars are:")
print(readVars)
except:
boxEngine.error.data404()
class error():
def noCvar():
error("File 'cvar.txt' in /data/txt/ wasn't found.")
def NotImplement():
warn("Sorry, but this function is not implemented yet!")
def ConfigFatal(Err):
console.print_exception(f"[bold][bright_red][Error!] Config file or an element is missing! -> {Err}")
def data404():
error("Data needed to access wasn't found.")
def userFail():
error("Input Password failed too many times.")
def user404():
error("User not found.")
class funct:
def echo(x): print(x)
def shellVer(): print(f"boxpyshell created by ValkTheBoxman\nver: {ver} Build: main\n(^ω^)\n")
class pc:
def info():
# get pc info
uname = platform.uname()
print(f"CPU bit:{platform.machine()}\n",f"PC OS: {platform.platform}\n",f"PC Nodename:{uname.node()}")
class animlib:
def loadingAnim(x,y) -> None:
top = "|"
right = ">"
left = "<"
if x == "load":
state = "loading... "
elif x == "exit":
state = "exiting... "
for i in range(y):
print(state,top, end="\r")
time.sleep(0.5)
print(state,left, end="\r")
time.sleep(0.5)
print(state,top, end="\r")
time.sleep(0.5)
print(state,right, end="\r")
time.sleep(0.5)
class pythonBasic:
class functions:
def length():
print("Count the letters in a word!")
string = input()
len(string)
def identify():
string = input()
id(string)
class math:
def add():
num1 = input("What is your first number? -> ")
num2 = input("What is your second number? -> ")
print(f"adding {num1} + {num2}")
print(int(num1) + int(num2))
def subtract():
num1 = input("What is your first number? -> ")
num2 = input("What is your second number? -> ")
print(f"subtracting {num1} - {num2}")
print(int(num1) - int(num2))
class fun:
def helloUser():
print("What is your name?")
name = input()
print(f"Hello!, {name}")
def eightBall():
print("Ask me a question and i shall give you an answer")
ques = input(" -> ")
list = ["Outlook Good","Outlook not so good","i cannot answer at this moment","It is certain.","It is decidedly so.","Without a doubt.","Yes definitely.","You may rely on it.","As I see it, yes.Most likely.","Yes.","Signs point to yes.","Reply hazy, try again.","Ask again later.","Better not tell you now.","Cannot predict now.","Concentrate and ask again.","Don't count on it.","My reply is no.","My sources say no.","Very doubtful."]
ans = random.choice(list)
print(ans)
def ynGame():
print("Ask me a yes or no question")
ques = input(" -> ")
list = ["Yes","No","Probably","Probably Not"]
ans = random.choice(list)
print(ans)