Don't allow unloading _core

Prevents getting stuck with no way of administrating the bot
This commit is contained in:
Dan Elkouby 2018-07-01 17:43:54 +03:00
parent f1141aa24f
commit c1e3b2f3c3
2 changed files with 4 additions and 4 deletions

View File

@ -37,9 +37,7 @@ async def handler(event):
The core features offered by the custom `TelegramClient` live under the The core features offered by the custom `TelegramClient` live under the
[`uniborg/`](https://github.com/uniborg/uniborg/tree/master/uniborg) [`uniborg/`](https://github.com/uniborg/uniborg/tree/master/uniborg)
directory, with some utilities, enhancements and the core plugin, which directory, with some utilities, enhancements and the core plugin.
can be unloaded in itself (something fun to do, but you will probably
want to restart your borg after).
## learning ## learning

View File

@ -36,7 +36,9 @@ async def remove(event):
await event.delete() await event.delete()
shortname = event.pattern_match["shortname"] 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) borg.remove_plugin(shortname)
msg = await event.respond(f"Removed plugin {shortname}") msg = await event.respond(f"Removed plugin {shortname}")
else: else: