-
Notifications
You must be signed in to change notification settings - Fork 0
Code Snippets
Nathan edited this page Nov 21, 2023
·
4 revisions
import command.command# ...
def foo(args: list):
print("Foo")
return True
def bar(args: list):
print("Bar")
return True
command_dict = {
"foo": foo,
"bar": bar
}
# Remember to not call () the functions, just type their names #
# ...command_base = command.CommandReader("./command/help.json", command_dict)
# replace with the path to your help file ^^^^^command_base.run("command_name", args)
# Args must be a list containing all arguments for the functiondef func_name(args: list): # Arguments must be (args: list) and nothing else
if len(args) != 0: # If input args are incorrect
return False # Used by the interpreter in order to show syntax errors
do_stuff()
return True # Is needed at the end of functionspip install rich