diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2022-10-20 08:04:03 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2022-10-20 08:04:03 +0200 |
commit | ad9e5400648e2d52d55705ccb3a7592bdaea310d (patch) | |
tree | ef921114d5d98841427dce12bf6095603d0c854f | |
parent | 418dab390e877e917e6719b3265af38d2cb049b5 (diff) | |
download | BerryClient-ad9e5400648e2d52d55705ccb3a7592bdaea310d.tar.gz BerryClient-ad9e5400648e2d52d55705ccb3a7592bdaea310d.zip |
add load, exec and help command to core addon
-rw-r--r-- | BerryClient/addons/core.py | 41 |
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 |