Skip to content

Commit 4860958

Browse files
authored
Update cmds.py
Moved cmds dict to this file for easier access and added a new `/reminder` command.
1 parent 72e8e2a commit 4860958

File tree

1 file changed

+78
-5
lines changed

1 file changed

+78
-5
lines changed

cmds.py

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,59 @@
22
import datetime
33
import formatting
44

5+
commands = {
6+
"help": {
7+
"command": "helpcmd",
8+
"arguments": "",
9+
"desc": "This sends you to this page!"
10+
},
11+
"services": {
12+
"command": "connect.list_processes",
13+
"arguments": None,
14+
"desc": "Lists down all the services used in this program, and gives you the option to enable or disable them"
15+
},
16+
"time": {
17+
"command": "timecmd",
18+
"arguments": None,
19+
"desc": "Prints the time and date! Pretty nifty, huh?"
20+
},
21+
"math": {
22+
"command": "mathcmd",
23+
"arguments": None,
24+
"desc": "[ALPHA] Doesn't really work for now but maybe someday soon it perhaps might be fixed!"
25+
},
26+
"reminder": {
27+
"command": "remindercmd",
28+
"arguments": None,
29+
"desc": "Command to edit the reminder note that pops up every time you start the program!"
30+
},
31+
"exit": {
32+
"command": exit,
33+
"arguments": None,
34+
"desc": "Stops the program. That's kind of it."
35+
},
36+
"quit": {
37+
"command": exit,
38+
"arguments": None,
39+
"desc": "Also stops the program. Exciting!"
40+
},
41+
"sqrt": {
42+
"command": "sqrtcmd",
43+
"arguments": None,
44+
"desc": "Brings up the custom kSquareRoot algorithm"
45+
},
46+
"cmds": {
47+
"command": "helpcmd",
48+
"arguments": "commands",
49+
"desc": "Prints all the commands in a neat little list!"
50+
}
51+
}
52+
53+
def print_commands():
54+
for key,value in commands.items():
55+
print(" /"+key)
56+
print(" - "+value["desc"])
57+
558
def kSquareRoot(tested_num, repetitions): # KasCode's Square Root finder algorithm!
659
current_min = 0
760
current_max = tested_num
@@ -91,11 +144,8 @@ def helpcmd(jump):
91144
if user_input == "commands":
92145
print("I have some built in commands that you can use such as time and math!")
93146
print("You start all commands with a \"/\" and then the command. Below is a list of all my commands'\n")
94-
print("/math - [ALPHA] This is still in development, but right now this is capable of doing basic math with only two numbers.")
95-
print("/help - This sends you to this page!")
96-
print("/services - Lists down all the services being used in this program, and gives you the option to disable/enable them")
97-
print("/time - Prints the time and date! Pretty nifty, huh?")
98-
print("/sqrt - Brings up the kSquareRoot function for finding the square root of the number you're looking for.")
147+
148+
print_commands()
99149
continue
100150

101151
if user_input == "input markers":
@@ -104,6 +154,7 @@ def helpcmd(jump):
104154
print(" [H] - help page input for detail on subjects")
105155
print(" [A] - answering input that will set whatever you write as the answer to your question")
106156
print(" [S] - service editing input")
157+
print(" [R] - reminder editing input")
107158
continue
108159

109160
def mathcmd():
@@ -139,3 +190,25 @@ def mathcmd():
139190
print(" [A] - answering input that will set whatever you write as the answer to your question")
140191
print(" [S] - service editing input")
141192
continue
193+
194+
def remindercmd():
195+
print("You are now editing the reminder!")
196+
print("Type the new reminder you want, type \"cancel\" to cancel or type \"clear\" to clear.")
197+
198+
rem_input = input("[R] ")
199+
new_reminder = ""
200+
cancelled = False
201+
202+
if rem_input == "cancel":
203+
print("Cancelled")
204+
cancelled = True
205+
elif rem_input == "clear":
206+
new_reminder = ""
207+
else:
208+
new_reminder = rem_input
209+
210+
if not cancelled:
211+
with open("reminder", "w") as reminder_w:
212+
reminder_w.write(new_reminder)
213+
214+
print("Reminder updated!")

0 commit comments

Comments
 (0)