aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2022-10-20 08:04:03 +0200
committerJan200101 <sentrycraft123@gmail.com>2022-10-20 08:04:03 +0200
commitad9e5400648e2d52d55705ccb3a7592bdaea310d (patch)
treeef921114d5d98841427dce12bf6095603d0c854f
parent418dab390e877e917e6719b3265af38d2cb049b5 (diff)
downloadBerryClient-ad9e5400648e2d52d55705ccb3a7592bdaea310d.tar.gz
BerryClient-ad9e5400648e2d52d55705ccb3a7592bdaea310d.zip
add load, exec and help command to core addon
-rw-r--r--BerryClient/addons/core.py41
1 files changed, 40 insertions, 1 deletions
diff --git a/BerryClient/addons/core.py b/BerryClient/addons/core.py
index 958bb2b..5923b46 100644
--- a/BerryClient/addons/core.py
+++ b/BerryClient/addons/core.py
@@ -1,5 +1,44 @@
-from BerryClient.commands import command
+import logging
+
+from BerryClient.commands import command, COMMANDS
+from BerryClient import __version__
+
+log = logging.getLogger(__name__)
+
+@command(name="help")
+def _help(core):
+ """
+ Displays this message
+ """
+
+ bar = "="*10
+ core.postToChat(f"§e{bar}§r BerryClient v{__version__} §e{bar}§r")
+
+ for name, info in COMMANDS.items():
+ if info["alias"]:
+ continue
+
+ description = info["description"] or ""
+ core.postToChat(f"§6{name}:§r {description}")
+
+@command()
+def load(core, addon: str):
+ """
+ Load an addon via a python module
+ """
+ core.load(addon)
@command(name="reload")
def _reload(core):
+ """
+ Reloads all addons
+ """
core.reload()
+
+@command(name="exec", aliases=["eval"])
+def _exec(core, *command):
+ """
+ Execute python code
+ """
+ print = log.info
+ return eval(" ".join(command)) \ No newline at end of file