From c1e3b2f3c351b38370972ae1150a868fb64761b7 Mon Sep 17 00:00:00 2001 From: Dan Elkouby Date: Sun, 1 Jul 2018 17:43:54 +0300 Subject: [PATCH] Don't allow unloading _core Prevents getting stuck with no way of administrating the bot --- README.md | 4 +--- uniborg/_core.py | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6b08237..a50a48b 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,7 @@ async def handler(event): The core features offered by the custom `TelegramClient` live under the [`uniborg/`](https://github.com/uniborg/uniborg/tree/master/uniborg) -directory, with some utilities, enhancements and the core plugin, which -can be unloaded in itself (something fun to do, but you will probably -want to restart your borg after). +directory, with some utilities, enhancements and the core plugin. ## learning diff --git a/uniborg/_core.py b/uniborg/_core.py index 933a5ee..77d105b 100644 --- a/uniborg/_core.py +++ b/uniborg/_core.py @@ -36,7 +36,9 @@ async def remove(event): await event.delete() shortname = event.pattern_match["shortname"] - if shortname in borg._plugins: + if shortname == "_core": + msg = await event.respond(f"Not removing {shortname}") + elif shortname in borg._plugins: borg.remove_plugin(shortname) msg = await event.respond(f"Removed plugin {shortname}") else: